在 `git push` 完成后执行命令,使用 git hook
Execute a command after `git push` finalize, using git hook
我试图在 git push
完成后 运行 命令,但它没有 运行
我尝试使用 post-receive
、post-update
和 pre-push
使用预推
一些信息:
git 版本 2.17.1
路径文件:testProject/.git/hooks/
Ubuntu 18.04.3 LTS
代码示例:
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
echo "test" > /home/Darck/Desktop/testProject/test.txt
# exec git update-server-info
post-receive/update are server-side hooks,所以如果你在本地定义了它们(在你进行推送的地方),它们无论如何都不会 运行。
pre-push hook 应该 运行,前提是它已在您自己的存储库中定义,并在 myrepo/.git/hooks/pre-push
中可执行
我试图在 git push
完成后 运行 命令,但它没有 运行
我尝试使用 post-receive
、post-update
和 pre-push
使用预推
一些信息:
git 版本 2.17.1
路径文件:testProject/.git/hooks/
Ubuntu 18.04.3 LTS
代码示例:
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
echo "test" > /home/Darck/Desktop/testProject/test.txt
# exec git update-server-info
post-receive/update are server-side hooks,所以如果你在本地定义了它们(在你进行推送的地方),它们无论如何都不会 运行。
pre-push hook 应该 运行,前提是它已在您自己的存储库中定义,并在 myrepo/.git/hooks/pre-push