Jenkins – Migration from SVN to Git.

Hi all,

I’ve been working on Migration of one of our Jenkins Projects from SVN to Git repository as the Source Code Manager(SCM). These are the steps I needed to perform to complete migration. :-

  • Install ‘Git Plugin’ on the Jenkins Master Setup.  For more information on the plugin goto https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin
  • Install the latest ‘git’ package on the Master as well as the slave.

Both my Master and Slave Machines are Linux based machines, so by default when we do a sudo apt-get install git or a sudo yum install git we get the git version 1.7.1 installed. But Jenkins specifies the git package to be more than 1.7.10 so I got the latest version 2.1.3 installed. For this we need to get the src files from the git repository and then manually install this version. The following steps installs Git 2.1.3 for you :-

1.Make sure Git is version 1.7.10 or higher, for example 1.7.12 or 1.8.4

git –version

2.If not, install it from source. First remove the system Git:

yum -y remove git
3.Install the pre-requisite files for Git compilation:
yum install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-devel openssl-devel
4.Download and extract it:
mkdir /tmp/git && cd /tmp/git
5.Configure & install:
cd git-2.1.3/
./configure
make
make prefix=/usr/local install
6.Make sure Git is in your $PATH:
which git
You might have to logout and login again for the $PATH to take effect. Note: When editing config/gitlab.yml (step 7), change the git bin_path to /usr/local/bin/git.
Once the git packages are installed , we need to configure the Jenkins master for the git installation.
For this Goto Jenkins Home > Manage Jenkins > Configure System . Enter the git installation location in the git section of this page :-
Screen Shot 2015-01-22 at 5.21.56 pm
Once this is done, in you Jenkins Job select ‘Git’ as the SCM & give in the fields like the repository URL , branch specifier etc.
I set the ‘Additional Behaviours’ field to ‘Wipe out repository and force clone’. This can be set according to ur requirements .
This did it for me. 🙂
Let me know if this works for you as well and if you ended up in roadblocks somewhere.
Regards,
VJ

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s