有没有办法在git hook中启用回显
/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 吗?
更新
目前我有正常的 git push
输出然后 ========post-update hook=========
...什么都没有
哦! git 版本是 1.5.6.5
最佳答案
应转发 stdout 或 stderr 上的所有输出。它预计适用于所有 pre-receive
、update
、post-receive
和 post-update
Hook 。在 bourne shell 中使用 set -x
启用回显命令。
关于Git 钩子(Hook) : enable echoing commands,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7266772/