Git issues in Jenkins

While connecting a git repository to Jenkins I got the following error:

Failed to connect to repository : Command 'git config -local credential.username username' returned status code 129:  
stdout:  
stderr: error: unknown option 'local'  
usage: git config [options]

The error happens because Jenkins requires git 1.8+, and only 1.7 is available in the CentOS 6.5 repos. Somewhere on the internet they write that the rpmforge-extras repo has a newer version. I checked - it does not.

I decided not to suffer for too long and to build git from source.

Preparation:

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y

The process itself:

wget https://www.kernel.org/pub/software/scm/git/git-2.6.1.tar.xz  
tar xf git-2.6.1.tar.xz  
cd git-2.6.1

Build it:

make prefix=/usr/local/git all

Install it:

make prefix=/usr/local/git install

Add /usr/local/git/bin to the PATH environment variable and apply the changes:

echo 'export PATH=$PATH:/usr/local/git/bin' >> /etc/bashrc  
source /etc/bashrc

The git version can be checked with the following command:

git -version

What is left is to tune the Jenkins settings. In the web interface go to Manage Jenkins -> Configure System
Screenshot from 2015-10-09 12:32:24

Find the Git section and set a sane value for Path to Git executable (/usr/local/git/bin/git)
Screenshot from 2015-10-09 12:41:26

Categories:

Updated: