Git hook:启用echoing命令

jon*_*nny 8 git githooks

有没有办法在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
Run Code Online (Sandbox Code Playgroud)

另一个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
Run Code Online (Sandbox Code Playgroud)

这只是一个例子,实际的命令链可能更复杂

在某个地方失败

我应该以某种方式将stdout重定向到stderr吗?

UPDATE

目前我有正常的git push输出然后========post-update hook========= ......什么都没有

哦! git版本是1.5.6.5

Jan*_*dec 4

应该转发 stdout 或 stderr 上的所有输出。它预计适用于所有pre-receiveupdate和挂钩。在 bourne shell 中启用回显命令。post-receivepost-updateset -x