Find plugins

Git client2.7.1Minimum Jenkins requirement: 1.625.3ID: git-client

View Jenkins Git client plugin on the plugin site for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

Shared library plugin for other Git related Jenkins plugins.

This plugin by itself does not provide any user-visible function; for that, see Git Plugin, of which this was originally part.


This plugin provides an API to execute general-purpose git operations on a local or remote repository. Its primary use is from the git-plugin; as such, it is also used by gerrit-plugin, git-parameter-plugin and cloudbees validated merge plugins. Plugin developers are encouraged to use GitClient API in replacement for the legacy IGitAPI.

Main goal is to isolate this low-level git stuff from git-plugin, then to re-implement a client using JGit.

For backwards compatibility, this plugin uses API classes from hudson.plugins.git package.


Plugin provides a builder-style factory to retrieve a GitClient:

GitClient git = Git.with(listener, environment)

Using "jgit" will force use of JGit implementation.


GIT_ASKPASS and permissions

The Git Client plugins uses GIT_ASKPASS and creates a temporary script to execute when git ask for credentials. This approach requires that the user running Jenkins or the Agent has the sufficient permissions (read/write/execute) on the temp folder.

This has always been true for SSH Authentication. It however has not always been the case for HTTP/s authentication. Since version 2.0.0, the Git Client plugin now uses GIT_ASKPASS for Username/Password credentials too. See the detailed explanation in this commit. If you are upgrading to this version ensure that the temporary folder permissions are configured accordingly.

Insufficient permissions on the temp folder would make git commands fail with a stacktrace similar to the following:

hudson.plugins.git.GitException: Command "/usr/local/bin/git fetch --tags --progress https://github.com/user/repo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stderr: fatal: cannot exec '/tmp/pass4619352834734512307.sh': Permission denied
fatal: could not read Username for 'https://github.com': No such device or address

Note: If security on the default temp folder is a concern, note that you can change the location of the temp folder in Jenkins via the system property `java.io.tmpDir`as explained in here. This would need to be done on the Jenkins master and the Agents.

Git for Windows and Windows Credential Manager

Installing modern Git for Windows with the default installation options chosen will result in the Windows Credential Manager being a source of credentials for git operations. At this time there are issues with this configuration of the Git Client for Windows when used with the Jenkins Git Client Plugin. Users have experienced attempted Git operations that never make any progress and eventually time out when targeting password-protected https repository locations. The solution is to uncheck the Windows Credential Manager feature at Git for Windows install time. Reference  JENKINS-34082 - Getting issue details... STATUS  as well as other Jenkins JIRA issues found via search (which shows as closed but does not mean this problem has been fixed yet!).


3.0.0-beta1 (Feb ??, 2018)

  • (info)   Require Java 8
  • (info)   Require at least Jenkins 2.60
  • (info)   Use JGit 4.10.0 instead of JGit 4.5.4
  • (info)   Honor timeout settings in JGit clone, fetch, and push
  • (error)   Fix openPackedFromSelfOrAlternate stack overflow in JGit (JENKINS-46344)

2.7.1 (Jan 25, 2018)

2.7.0 (Dec 18, 2017)

  • (error)   Add GitClient.getTags() to fix git rev-parse related checkout performance regression (JENKINS-45447 and JENKINS-47169)
  • (error)   Fix submodule cloning for repository URLs that end with '.url' (JENKINS-46054)
  • (error)   Make GitClient.getRemoteReferences() return empty map from both implementations when remote references are not found (JENKINS-30589)
  • (info)   Use JGit 4.5.4 (rather than JGit 4.5.3) (fix some cases of incorrect NFS file locking)
  • (info)   Improve GitClient.isCommitInRepo() performance with the "--no-walk" argument

2.6.0 (Oct 27, 2017)

  • (error)   Fix unit test failures on freshly installed systems (JENKINS-47373)
  • (error)   Fix ArrayBoundsException when repository includes commit with embedded control character(JENKINS-45894, JENKINS-47196)
  • (info)   Use env vars to prevent command line credential (CLI git 2.3+) prompts which block the plugin (JENKINS-35959, JENKINS-25878)
  • (info)   Add API to support LFS credentials separate from repository credentials (JENKINS-47531)
  • (info)   Report the path to a reference repository if reference repository is configured and used (JENKINS-46737)
  • (info)   Use JGit 4.5.3 (rather than JGit 4.5.2)
  • (info)   Use apache http client plugin and jsch as bundled with Jenkins

2.5.0 (Jul 27, 2017)

  • (error)   Honor credential path exclusion (JENKINS-43022)
  • (error)   Fix a submodule case of "no revision to build" (JENKINS-45729)
  • (info)   Add a RECURSIVE_THEIRS merge strategy
  • (info)   Detect setsid command in /usr/local/bin (MacOS) (JENKINS-20879)
  • (info)   Allow boolean options to be toggled rather than just set (JENKINS-45771)

2.4.6 (May 24, 2017)

2.4.5 (Apr 29, 2017)

  • (error)   Fix Windows regression when using passphrase protected private keys with a workspace name containing a space (JENKINS-43931)

2.4.4 (Apr 27, 2017)

2.4.2 (Apr 20, 2017)

  • (info)   Support passphrase protected private keys even when Jenkins is attached to a controlling terminal (docker with "-it" argument, or "mvn hpi:run") (JENKINS-20879, JENKINS-25194)
  • (info)   Require credentials plugin 2.1.13 for credentials tracking API support
  • (info)   Use JGit 4.5.2 (bug fix)
  • (info)   Add Italian language translation

2.4.1 (Mar 30, 2017)

2.4.0 (Mar 24, 2017)

  • (info)   Add API to determine default remote branch (JENKINS-40834)
  • (info)   Use JGit 4.5.1 (bug fixes)

2.3.0 (Feb 28, 2017)

2.2.1 (Jan 16, 2017)

2.2.0 (Jan 2, 2017)

2.1.0 (Nov 3, 2016)

2.0.0 (Sep 10, 2016)

  • (info)   Require Java 7 (Jenkins 1.625 or newer) - try with resources and other code simplifications
  • (info)   Use JGit 4.4.1
  • (info)   Use Apache httpclient 4.5.2

1.21.0 (Aug 20, 2016)

1.19.7 (Jul 15, 2016)

2.0.0-beta1 (Jun 14, 2016)

  • (info)   Require Java 7 (Jenkins 1.625 or newer) - try with resources and other code simplifications
  • (info)   Use JGit 4.3.1 (though may be affected by JGit bug 496262)
  • (info)   Use Apache httpclient 4.5.2

1.20.0-beta3 (Mar 10, 2016)

1.19.6 (Mar 6, 2016)

  • (error)   Guard rev-parse calls from surprise blank lines (JENKINS-20991)
  • (error)   Reduce memory use generating changelog (JENKINS-31326 partial fix, also needs new git plugin)

1.19.5 (Feb 17, 2016)824604b

  • (info)   Warn if JGit fetch attempted with shallow clone options, don't throw exception

1.19.4 (Feb 9, 2016)

  • (error)   Fix one case of passphrase protected ssh clone (JENKINS-32834)

1.19.3 (Feb 6, 2016)

1.19.2 (Jan 9, 2016)

  • (error)   Improve performance of calls to git rev-parse (JENKINS-32258)

1.20.0-beta1 (Nov 4, 2015)

  • (info)   Support submodule authentication (JENKINS-20941) - requires git plugin 2.5.0-beta1

1.19.1 (Dec 26, 2015)

1.19.0 (Aug 20, 2015)

1.18.0 (Jul 18, 2015)

  • (info)   Update minimum Jenkins version from 1.509 to 1.532.2
  • (info)   Update JGit to 3.7.1
  • (info)   Add squash as merge option (JENKINS-28833)
  • (error)   Allow Linux ssh keys with passphrase (JENKINS-20638, JENKINS-20879, JENKINS-27998)
  • (error)   Implement prune for JGit repositories (JENKINS-26197)
  • (error)   Improve checkout failure message (JENKINS-26748)
  • (error)   Use ISO-8601 date format in changelog (JENKINS-27097)
  • (error)   Find ssh.exe on Windows even if git is in cmd directory (JENKINS-28943)
  • (error)   Guard against null pointer exceptions in several API calls
  • (info)   Update other dependencies (httpclient 4.4.1, ssh-credentials 1.11, etc.)

1.17.1 (May 8, 2015)

1.17.0 (Apr 25, 2015)

  • (info)   Update minimum Jenkins version from 1.509 to 1.532.2
  • (info)   Update JGit to 3.7.0
  • (error)   Implement prune for JGit repositories (JENKINS-26197)
  • (error)   Use ISO-8601 date format in changelog (JENKINS-27097)
  • (error)   Improve checkout failure message (JENKINS-26748)
  • (error)   Guard against null pointer exceptions in several API calls
  • (info)   Update other dependencies (httpclient 4.4.1, ssh-credentials 1.11, etc.)

1.16.1 (Feb 6, 2015)

  • (info)   Allow API access to all merge modes, including fast forward, and no fast forward (JENKINS-12402)
  • (info)   Allow clone with multiple refspecs (JENKINS-26417)
  • (info)   Improve javadoc, including fixes for Java 8 javadoc

1.15.0 (Jan 6, 2015)

  • (info)   Update from JGit 3.6.0 to JGit 3.6.1
  • (error)   Guard web pages with "jelly escape"

1.14.1 (Dec 27, 2014)

  • (error)   Only use "-c core.askpass=true" if command line git is newer than 1.7.9 (don't break really old git versions unnecessarily)

1.14.0 (Dec 25, 2014)

1.13.0 (Dec 18, 2014)

  • (error)   Update from JGit 3.5.2 to JGit 3.5.3 (CVE-2014-9390)
  • (error)   Remove .git/index.lock on command line git crash (JENKINS-25353)
  • (info)   Update a few dependencies, resolve a few findbugs warnings

1.12.0 (Nov 25, 2014)

  • (info)   Update from JGit 3.5.1 to JGit 3.5.2
  • (info)   Revision object now provides equals() and hashCode() (JENKINS-25639)
  • (info)   Update commons-codec to 1.10

1.11.1 (Nov 7, 2014)

  • (info)   Allow reference repositories with JGit - faster clone/fetch when commits are already in the reference repo (JENKINS-25387)
  • (info)   Add getBranchesContaining() to GitClient API - report branches containing a specific SHA1
  • (info)   Add getRemoteReferences() to GitClient API - list remote references without a repository
  • (info)   Allow PushCommand to push tags
  • (error)   Fix JGit fetch() to match CliGit behavior - delete local changes (JENKINS-25444)
  • (info)   Various test additions and improvements

1.11.0 (Oct 18, 2014)

  • (info)   Update from JGit 3.4.1 to JGit 3.5.1
  • (info)   Bundle jgit http server in git-client-plugin for easier version maintenance (JENKINS-21756)
  • (info)   Various test additions and improvements

1.10.2 (Sep 12, 2014)

  • (info)   Support authenticating proxies (JENKINS-24112)
  • (info)   Add API entry point for getRemoteTagNames
  • (info)   Warn Windows users if TEMP or TMP contains embedded space (JENKINS-22706)
  • (error)   Fix tag comparison (when refs/tags/tag_name is the branch to build) so tag based builds don't build at every poll (JENKINS-23299)

1.10.1 (July 30, 2014)

  • (info)   Timeout on checkout can be adjusted (JENKINS-22400)
  • (info)   Add API entry point to list first parent of revision list

1.10.0 (July 22, 2014)

  • (info)   Allow "Branches to build" to use refs/heads/ to specify branch precisely (JENKINS-23884, JENKINS-23266)
  • (info)   Add API entry points to manage refs through GitClient

1.9.2 (July 16, 2014)

  • (info)   Upgrade JGit to 3.4.1, httpclient 4.3.4, ssh-credentials 1.7.1
  • (info)   Simplify the pom
  • (error)   Improve ssh.exe location guessing on Windows (JENKINS-21806)
  • (error)   Reset tracked file local modifications on JGit checkout (JENKINS-23424)

1.9.1 (May 21, 2014)

  • (info)   Simplify the pom
  • (error)   Support polling behind an http proxy (JENKINS-22999)
  • (error)   Remove temp directory after authenticated fast remote poll (JENKINS-23017)

1.9.0 (May 8, 2014)

  • (info)   Allow timeout setting for submodule updates (JENKINS-22400)
  • (info)   Upgrade JGit to 3.4.0
  • (info)   Several test related improvements (Windows "busy file" test failures silenced on JDK 8, etc.)
  • (error)   Correctly display first revision when using JGit (JENKINS-22343)

1.8.1 (May 3, 2014)

  • (info)   Allow switch branch of a submodule before update (for later use in git plugin)
  • (info)   Upgrade JGit to 3.3.2
  • (info)   Several test related improvements (JaCoCo 0.7.0, Windows "busy file" test failures silenced, etc.)
  • (info)   Log executed git commands for easier diagnosis
  • (error)   Only use progress argument on git versions which support it
  • (error)   Warn if git version is too old for credentials support (JENKINS-21887)
  • (error)   Use a new temporary directory for remote polling of authenticated repositories (JENKINS-22039)

1.8.0 (Apr 3, 2014)

  • (info)   Upgrade JGit from 3.3.0 to 3.3.1
  • (info)   Update remote tracking branch support for submodules if using command line git version 1.8.2 or newer

1.7.0 (Mar 27, 2014)

  • (error)   Fix symlink behavior in CliGit checkout (JENKINS-22376, JENKINS-21168, and JENKINS-22391)
  • (info)   Add remote tracking branch support for submodules if using command line git version 1.8.2 or newer

1.6.6 (Mar 25, 2014)

  • (info)   Switch CheckoutCommand from abstract class to interface (sparse checkout support)

1.6.5 (Mar 22, 2014)

  • (info)   Add sparse checkout support (requires git-plugin 2.0.5, requires git 1.8.2)
  • (info)   Upgrade JGit from 3.2.0 to 3.3.0
  • (info)   Enable push from JGit
  • (info)   QA improvements (more tests)

1.6.4 (Mar 6, 2014)

  • (info)   Add NTLM authentication (for Team Foundation Server git implementation)
  • (info)   Support branch change detection in branches using namespaces (e.g. develop1/master)
  • (info)   Replace obsolete Apache HttpClient with Apache HttpComponents
  • (warning)   Require at least Jenkins 1.509 so that authentication can be tested
  • (info)   QA improvements (more tests, findbugs warnings fixes, etc.)

1.6.3 (Feb 20, 2014)

  • (error)   Set remote URL during clone (implemented as init + fetch) to mimic an actual clone
  • (info)   CLI impl getRemoteUrl support empty git directory (align to JGit impl)
  • (info)   QA improvements

1.6.2 (Feb 04, 2014)

1.6.1 (Jan 10, 2014)

  • (error)  Warn when credentials.helper can be removed form config but don't fail the command
  • (error)  Fix git-credentials-store syntax(JENKINS-21016)
  • (error)  Fix a file leak when JGit is used(JENKINS-19994)
  • (info)  Test coverage improvement (thanks to Mark Waite)
  • (info)  Throw GitLockFailedException on lock failure (to allow retry)
  • (info)  printing error message on SSLException to help diagnose ssl problems

1.6 (Dec 18, 2013)

  • (info)  Method to push to URL (not implemented yet by JGit)
  • (info)  Method to add URL for remote (i.e. git config --add remote.foo.url bar)

1.5 (Dec 14, 2013)

1.4.6 (Oct 30, 2013)
  • (error)     Fix ssh private key support (using GIT_SSH) (issue #20223)
  • (error)     Append .git extension to repository URL on 404 (issue #20189)
  • (error)     Fix http proxy support (issue #20326)
  • (error)     Set a time-out running git commands (org.jenkinsci.plugins.gitclient.Git.timeOut, defaults to 10 minutes) (issue #11286)
1.4.5 (Oct 24, 2013)
1.4.4 (Oct 22, 2013)
  • (error)    Make JGit checkout compliant with CliGit
  • (error)    Support for http proxy (issue #20218)
1.4.3 (Oct 17, 2013)
  • (error)   Fix changelog generation on windows (JENKINS-18995)
  • (error)   Add support for .netrc as credential source for http(s) transport (backward compatibility)
1.4.2 (Oct 13, 2013)
  • (error)  Fix username/password support (JENKINS-19974, JENKINS-19995)
  • (error)  username/password can also be set in repository URL (backward compatibility issue)

1.4.0 (Oct 10, 2013)

  • (info) JGit upgrade
  • (info) add support for username/password credentials

1.3.0 (Sep 21, 2013)

  • (info) add support for --shared option
  • (info) JGit upgrade
  • (info) align JGit behavior for checkout to git-cli one (JENKINS-18988)
  • (error) bug in JGit implemenation (JENKINS-19108)

1.2.0 (Sep 16, 2013)

  • (info)  support for SSH Credentials within Git CLI implementation using ssh-agent plugin

1.1.2 (Aug 07, 2013)

  • (info) integration with updates to Credentials and SSH Credentials plugins
  • (error) bug in JGit implementation of git-describe

1.1.1 (Jul 25, 2013)

  • (error) misnamed resource

1.1 (Jul 24th, 2013)

  • (info) JGit implementation is feature complete
  • (info) GitClient interface is now remotable (can be used safely as an argument/return value to remote call)

1.0.7 (June 6th, 2013)

  • (error) Fixed exception when trying to use Git plugin immediately after installing without restart.

1.0.6 (may 11, 2013)

  • (info) Resurrect the checkoutBranch method
  • (info) Support multi-line commit messages for tags

1.0.5 (march 21, 2013)

  • (warning) reverted default implementation to use git-cli, after many regressions reported by users. org.jenkinsci.plugins.gitclient.Git.useCLI=false can be used to test JGit support.

1.0.4 (march 12, 2013)

  • (error) consider first installation as "Default" if not explicitly set (JENKINS-17013).
  • (info) implement clean, revParse, deleteTag, getTagMessage, hasGitRepo, isCommitInRepo, addSubmodule in pure JGit
  • (info) introduce new method to commit with committer/author
  • (warning) use JGit implementation in GitAPI for all supported methods, until org.jenkinsci.plugins.gitclient.Git.useCLI is set

1.0.3 (feb. 28, 2013)

  • (error) delete workspace content, not workspace directory, before cloning (JENKINS-16873)
  • (error) warn and ignore parameter, but don't break if reference is invalid (JENKINS-16911)
  • (error) clarify API usage with more explicit parameter name (JENKINS-16914)
  • (error) lock on repository files (issue #12188)
  • (info) implement push in pure JGit

1.0.2 (feb. 19, 2013)

  • initial design, with GitClient factory
ArchivesGet past versions
Previous Security Warnings