0

我已经按照本教程“使用 Git 管理网站”,使用 Tower 提交本地存储库并将其推送到远程服务器。推送成功并显示以下消息:

Pushing to ssh://user@mysite.com/~/git/tprevo.git
stdin: is not a tty
Counting objects: 40, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (37/37), done.
Writing objects: 100% (40/40), 171.95 KiB, done.
Total 40 (delta 3), reused 0 (delta 0)
To ssh://user@mysite.com/~/git/tprevo.git
 * [new branch]      master -> production
updating local tracking ref 'refs/remotes/production/production'

Successfully created tracking connection.

我已经验证了我的 post-receive 挂钩正在执行,但是该checkout命令没有将推送的代码添加到我认为我已经设置为我的工作目录的目录中。我整天都在想办法解决这个问题。

收到后:

#!/bin/sh
GIT_WORK_TREE=/home/tprevo/public_html/tprevo git checkout -f

我是 Git 新手,非常渴望学习。调试这个的最佳方法是什么?

4

1 回答 1

7

好的......我有一个类似的设置......你的文件是可执行的吗?请检查文件属性...

ls -la post-receive

如果它不可执行,那么您需要对其进行 chmod ...

sudo chmod +x post-receive

更新

注意到您有一个命名分支,您可能希望在 checkout 命令中为您的 post-receive 钩子指定特定的...

git checkout -f production
于 2012-06-20T23:36:06.473 回答