有没有办法在 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
在另一台机器上所需的 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
and post-update
钩子。回显命令已启用set -x
在伯恩壳中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)