0

这有点奇怪,所以我在远程 git repo 钩子脚本 post-receive 中有这一行:

cd /path/to/my/deployed/app
git reset --hard
rm files/.development

我从我的本地机器推送到我的 git 仓库——这就是奇怪的地方。在我的 post-receive 末尾的那些行是在我的本地机器上执行的,而不是在我的远程服务器上?

显然我最终得到了这个错误:

MacBook-Air:$ git push to-my-deployed-app

Counting objects: 23, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (16/16), 2.56 KiB, done.
Total 16 (delta 11), reused 0 (delta 0)
remote: warning: updating the current branch
remote: fatal: Not a git repository: '.'
remote: rm: cannot remove `files/.development': No such file or directory

所以那里..很奇怪...

4

1 回答 1

4

为什么你认为它在本地运行?每个错误前的前缀remote:表示它来自远程。从这些错误来看,您的存储库的路径似乎是错误的。实际上,如果您尝试git reset --hard在钩子所在的存储库中运行,则不需要更改目录 - 钩子的当前工作目录无论如何都将是该存储库的顶层。

于 2011-03-22T20:48:56.860 回答