[英]Git hook: enable echoing commands
有没有办法在git hook中启用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
另一个mashine所需的git push输出:
#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吗?
UPDATE
目前我有正常的git push
输出然后========post-update hook=========
...什么都没有
哦! git版本是1.5.6.5
应转发stdout或stderr上的所有输出。 它预计适用于所有pre-receive
, update
, post-receive
post-update
挂钩。 在bourne shell中使用set -x
启用了回显命令。
来自githooks
手册:
标准输出和标准错误输出都转发到另一端的git send-pack,因此您可以简单地为用户回显消息。
但是在一些早期版本的Git以及早期版本的Smart HTTP中存在一个已知问题,即输出未发送。 更新您的git版本并尝试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.