gpt4 book ai didi

python - 预接收 Hook 中的 git push 选项

转载 作者:太空狗 更新时间:2023-10-29 14:35:47 24 4
gpt4 key购买 nike

我正在用 python 编写一个 git pre-receive 钩子(Hook),并希望在推送选项中接收从命令行传递的参数。

git push -push-option='my option'

如何访问我的预接收 Hook 内的推送选项?

最佳答案

参见 githook documentation .

The number of push options given on the command line of git push
--push-option=...
can be read from the environment variable GIT_PUSH_OPTION_COUNT, and the options themselves are found in GIT_PUSH_OPTION_0, GIT_PUSH_OPTION_1,…​ If it is negotiated to not use the push options phase, the environment variables will not be set. If the client selects to use push options, but doesn’t transmit any, the count variable will be set to zero, GIT_PUSH_OPTION_COUNT=0.

关于python - 预接收 Hook 中的 git push 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48463761/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com