JGit pre-receive hook

When using JGit, push to a remote machine that is on the same server.

1), if the console has been set up with file://

or /path/to/git/remote

, the pre-take hook will not be executed.

2), if the console has been configured with ssh://

, the pre-take hook will be performed.

If you do the same push using the Git command line, the pre-take hook will always be executed.

I don't understand why this is happening.

+5


source to share


2 answers


JGit doesn't support all hooks; when you push through ssh:

, the git remote server implementation does git hook support. When you use JGit to move to a local repository, it just updates the local content of the repository. (I'm not even sure if pushing to a local repository with a native git

client will do pre-receive

, since it doesn't work git upload-pack

and therefore doesn't do a checkout.



+1


source


jGit 5+ supports PreReceiveHooks.



https://download.eclipse.org/jgit/site/5.0.1.201806211838-r/apidocs/org/eclipse/jgit/transport/PreReceiveHook.html

0


source







All Articles