Git钩子:启用回显命令
有没有办法在git钩子中启用echoGit钩子:启用回显命令,git,githooks,Git,Githooks,有没有办法在git钩子中启用echo /var/git/repositories/project.git/hooks/post-update #!/bin/bash unset GIT_DIR; echo '========post-update hook=========' cd /var/project; git reset --hard; git checkout testing; git pull; chmod -R 774 ./lib update-apps 另一个mashin
/var/git/repositories/project.git/hooks/post-update
#!/bin/bash
unset GIT_DIR;
echo '========post-update hook========='
cd /var/project;
git reset --hard;
git checkout testing;
git pull;
chmod -R 774 ./lib
update-apps
另一个mashine上所需的git推送输出:
#git push
...
Writing objects: 100% (10/10), 5.98 KiB, done.
Total 10 (delta 3), reused 8 (delta 1)
========post-update hook=========
cd /var/project
git reset --hard
git checkout testing
git pull
chmod -R 774 ./lib
update-apps
这只是一个例子,实际的指挥链可能更复杂
然后在某个地方失败
我是否应该以某种方式将stdout重定向到stderr
更新
目前我有正常的git push输出,然后是更新后的hook
... 什么也没有
哦!!git版本是1.5.6.5所有stdout或stderr上的输出都应该转发。它预计适用于所有
接收前
、更新
、接收后
和更新后
挂钩。通过bourne shell中的set-x
启用回显命令。来自githooks
手册:
标准输出和标准错误输出都转发给git
在另一端发送包,这样您就可以简单地为
用户
但在一些早期版本的Git和早期版本的Smart HTTP中存在一个已知问题,即输出不被发送。更新您的git版本并重试。但您尝试时的实际输出是什么?请检查挂钩是否可执行(chmod+x)