【发布时间】:2012-03-02 21:25:46
【问题描述】:
我想将我的文件直接推送到我的网络服务器。我将服务器添加为testing并尝试了
git push testing
但我得到this error。制作裸存储库的解决方案有效,但我希望自动签出文件。我找到了这个script,但这并没有改变任何东西。
我可以通过第三个裸存储库传输更改,但这需要很长时间:
client:
git commit -m "test" -a
git push origin
<password>
server:
git pull origin/master
更新(2)
我在服务器上创建了一个新分支git branch testing。
还在我创建的服务器上 .git/hooks/post-update 并添加了:
echo "a" >> /home/pi/log
git update-server-info
git stash
git merge testing >> /home/pi/log
在我运行的客户端上
git push testing HEAD:testing
现在我的/home/pi/log 包含:
a
Updating ae2f44b..04753a9
Fast-forward
application/views/main/index.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
但是文件没有改变。还有什么问题?
【问题讨论】:
-
至少将 fetch+merge 组合在一个 pull 中;脚本应该可以工作,要么你做错了,要么你应该能够调试东西(添加记录你的钩子以查看它为什么会中断?什么版本的 git?)
-
我在顶部添加了
echo "test" > /home/pi/test.git/hooks/post-update却一无所获。 -
您是否进行了 chmod(针对正确的用户;考虑 chmod a+x)?你给这个脚本起什么名字?文件系统是否挂载 noexec? (如果其中任何一个修复它,我会将其发布为答案:))
-
好的,脚本已执行,但我没有在脚本中发现错误。我会尝试 Simons 解决方案。
-
经过多次编辑,这是一个新问题:stackoverflow.com/questions/9228921/…
标签: git