git with jenkins

Posted on Monday, January 27, 2014


This guide will go over installing the git plugin for Jenkins.  Jenkins already installed and running (Very basic setup).

Install git via apt-git


First git needs to be installed on the Ubuntu machine


> sudo apt-get install git




Install plug in

Open your Jenkins install in a web browser.  Mine happens to be located at http://192.168.0.7:8080/

After you login click on Manage Jenkins






Click on Manage Plugins







Click on the Available Tab




In the filter enter "git plugin"
Then select "Git Plugin" and finally click on "Install without restart"








Plug-in installation starts






After the plug-in is successfully installed click on "Go back to the top page"




SSH keys


Create the ssh keys in the Jenkins home directory.  In my set up the Jenkins home directory is at /var/lib/jenkins

Switch over to the Jenkins user and create its ssh keys


> sudo su jenkins
> cd
> ssh-keygen -t rsa -b 2048


Copy the .ssh/id_rsa.pub key to your git remote repository





Setting up a remote git repository in a job



Click on New Job





Name it Test
Select "Build a free-style software project"
Click OK






Select "Git" then enter your remote repository connection url.

For example sshL//git@www.example.com/my_git_project.git








Click Save





Click Build now









The Build was successful





This is a very simple deploy, all it does is download from the git remote repository.





References



No comments:

Post a Comment