Git Server Plugin

Skip to end of metadata
Go to start of metadata

Plugin Information

Plugin ID git-server Changes In Latest Release
Since Latest Release
Latest Release
Latest Release Date
Required Core
1.6 (archives)
Dec 18, 2014
git-client (version:1.11.0)
Source Code
Issue Tracking
Pull Requests
Open Issues
Pull Requests
n/a (id: kohsuke)
Usage Installations 2014-Nov 6437
2014-Dec 6741
2015-Jan 7269
2015-Feb 7517
2015-Mar 8274
2015-Apr 8335
2015-May 8569
2015-Jun 9030
2015-Jul 9804
2015-Aug 10172
2015-Sep 10943
2015-Oct 11627

This plugin wraps the server-side functionality of JGit so that other plugins can easily expose Git repositories from Jenkins via its SSH transport and HTTP in a collaborative fashion. This plugin is a library plugin, in the sense that it doesn't have any user visible feature on its own.

See Git userContent plugin as a nice and short example of how to take advantages of this feature.

Developer Guide

In terms of code, there are two classes that plugins like git-userContent-plugin should be interested in.

One is HttpGitRepository, which represents Git repository access via HTTP. Typically you have some directory inside $JENKINS_HOME that houses the repository, then you subtype GitHttpRepository and override abstract methods to fill in the missing details. FileBackedHttpGitRepository is a convenient default implementation that simplifies this further. GitUserContentRepository in git-userContent-plugin is an example of using this class. This use also implements RootAction to bind this repository at http://server/jenkins/userContent.git, and I expect this combination to be fairly common.

The other class of interest is RepositoryResolver. Git server plugin adds necessary Jenkins SSH CLI hook for exposing Git repositories over SSH. The only missing link here is that when the client runs "git clone ssh://server/foo/bar/zot.git", we need to figure out what repositories on the server corresponds to /foo/bar/zot.git, and that's what the RepositoryResolver extension point does. The sample implementation in git-userContent-plugin will be hopefully self-explanatory. In this case, GitUserContentRepository is a singleton (because it's RootAction), so we inject that and basically just delegate the calls to it.


1.6 (Dec 18 2014)

1.5 (Nov 14 2014)

  • git-push via HTTP will work correctly even when CSRF protection is enabled. No more "No valid crumb was included in request" error.

1.4 (Oct 14 2014)

  • De-couple jgit dependencies from Git Client Plugin to avoid LinkageError caused by jgit version incompatibility.

1.3 (Feb 10 2014)

1.2 (Aug 09 2013)

  • JGit incompatibility with new Git Client plugin (JENKINS-18973)


plugin-library plugin-library Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.