[英]JGit pre-receive hook
When using JGit do a push to remote which is on the same server. 使用JGit时,请执行同一服务器上的远程推送。
1) if the remote was configured with file://
or /path/to/git/remote
, the pre-receive hook won't be executed. 1)如果远程配置了
file://
或/path/to/git/remote
,则不会执行预接收挂钩。
2) if the remote was configured with ssh://
, the pre-receive hook will be executed. 2)如果远程配置了
ssh://
,则将执行预接收挂钩。
If doing the same push using the Git command line, pre-receive hook will always be executed. 如果使用Git命令行执行相同的推送,将始终执行预接收挂钩。
I don't understand why this is happening. 我不明白为什么会这样。
JGit doesn't support all hooks; JGit不支持所有挂钩; when you push via
ssh:
the remote server's git implementation is performing the git hook support. 当你通过
ssh:
推送时ssh:
远程服务器的git实现正在执行git hook支持。 When you use JGit to push to a local repository it's just updating the local contents of the repository. 当您使用JGit推送到本地存储库时,它只是更新存储库的本地内容。 (I'm not even sure if pushing to a local repository with a native
git
client will execute a pre-receive
since it's not running git upload-pack
and therefore not doing a receive. (我甚至不确定推送到本地
git
客户端的本地存储库是否会执行pre-receive
因为它没有运行git upload-pack
,因此没有进行接收。
jGit has support for PreReceiveHooks, but you need to implement this hook - it is not read from hook directory. jGit支持PreReceiveHooks,但是你需要实现这个钩子 - 它不是从钩子目录中读取的。
https://download.eclipse.org/jgit/site/5.0.1.201806211838-r/apidocs/org/eclipse/jgit/transport/PreReceiveHook.html https://download.eclipse.org/jgit/site/5.0.1.201806211838-r/apidocs/org/eclipse/jgit/transport/PreReceiveHook.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.