Jenkins : Git Server Plugin

Plugin Information

View GIT server on the plugin site for more information.

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.

Changelog

1.8 and newer

SeeĀ GitHub releases.

1.7 (July 12, 2016)

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)