{jenkins-plugin-info:git-client}

Official Documentation

'Shared library plugin for other Git related Jenkins plugins.

Usage

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

GitClient git = Git.with(listener, environment)
   .in(repository)
   .using(gitExe)
   .getClient();

Using "jgit" will force use of JGit implementation.

Gotchas

GIT_ASKPASS and permissions

The Git Client plugins uses GIT_ASKPASS and creates a temporary script to execute when git prompts 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:
stdout:
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.

Change Log - Moved to GitHub

2.8.0 (June 16, 2019)

3.0.0-beta9 (April 24, 2019)

2.7.7 (April 11, 2019)

2.7.6 (January 10, 2019)

2.7.5 (December 22, 2018)

2.7.4 (November 16, 2018)

2.7.3 (July 24, 2018)

2.7.2 (May 12, 2018)

2.7.1 (January 25, 2018)

2.7.0 (December 18, 2017)

2.6.0 (October 27, 2017)

2.5.0 (July 27, 2017)

2.4.6 (May 24, 2017)

2.4.5 (April 29, 2017)

2.4.4 (April 27, 2017)

2.4.2 (April 20, 2017)

2.4.1 (March 30, 2017)

2.4.0 (March 24, 2017)

2.3.0 (February 28, 2017)

2.2.1 (January 16, 2017)

2.2.0 (January 2, 2017)

2.1.0 (November 3, 2016)

2.0.0 (September 10, 2016)

1.21.0 (August 20, 2016)

1.19.7 (July 15, 2016)

2.0.0-beta1 (June 14, 2016)

1.20.0-beta3 (March 10, 2016)

1.19.6 (March 6, 2016)

1.19.5 (February 17, 2016) 824604b

1.19.4 (February 9, 2016)

1.19.3 (February 6, 2016)

1.19.2 (January 9, 2016)

1.20.0-beta1 (November 4, 2015)

1.19.1 (December 26, 2015)

1.19.0 (August 20, 2015)

1.18.0 (July 18, 2015)

1.17.1 (May 8, 2015)

1.17.0 (April 25, 2015)

1.16.1 (February 6, 2015)

1.15.0 (January 6, 2015)

1.14.1 (December 27, 2014)

1.14.0 (December 25, 2014)

1.13.0 (December 18, 2014)

1.12.0 (November 25, 2014)

1.11.1 (November 7, 2014)

1.11.0 (October 18, 2014)

1.10.2 (September 12, 2014)

1.10.1 (July 30, 2014)

1.10.0 (July 22, 2014)

1.9.2 (July 16, 2014)

1.9.1 (May 21, 2014)

1.9.0 (May 8, 2014)

1.8.1 (May 3, 2014)

1.8.0 (April 3, 2014)

1.7.0 (March 27, 2014)

1.6.6 (March 25, 2014)

1.6.5 (March 22, 2014)

1.6.4 (March 6, 2014)

1.6.3 (February 20, 2014)

1.6.2 (February 04, 2014)

1.6.1 (January 10, 2014)

1.6 (December 18, 2013)

1.5 (December 14, 2013)

1.4.6 (October 30, 2013)

1.4.5 (October 24, 2013)

1.4.4 (October 22, 2013)

1.4.3 (October 17, 2013)

1.4.2 (October 13, 2013)

1.4.0 (October 10, 2013)

1.3.0 (September 21, 2013)

1.2.0 (September 16, 2013)

1.1.2 (August 07, 2013)

1.1.1 (July 25, 2013)

1.1 (July 24th, 2013)

1.0.7 (June 6th, 2013)

1.0.6 (May 11, 2013)

1.0.5 (March 21, 2013)

1.0.4 (March 12, 2013)

1.0.3 (February 28, 2013)

1.0.2 (February 19, 2013)