Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Git plugin and Refspecs

Tags:

What is the difference between Refspec and Branch specifier (blank for default): in the below Jenkins job configuration:

enter image description here

I have tried to set the Refspec option in the job configuration:

+refs/heads/master:refs/remotes/origin/master 

In the cloned repo on my build slave the .git/config file looks like this:

[core]         repositoryformatversion = 0         filemode = true         bare = false         logallrefupdates = true [remote "origin"]         url = https://user:[email protected]/scm/PROJECT/project.git         fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"]         remote = origin         merge = refs/heads/master 

It seems that the value for fetch is not correct (read from the jenkins job configuration). Further it has no effect on the diskspace consumption.

like image 279
u123 Avatar asked Mar 16 '13 09:03

u123


People also ask

What is the plugin of Git in Jenkins?

The git plugin provides Git Username and Password binding that allows authenticated git operations over HTTP and HTTPS protocols using command line git in a Pipeline job. The git credential bindings are accessible through the withCredentials step of the Credentials Binding plugin.

Can we use GitHub plugin in Jenkins?

Build integration With the help of the Git plugin Jenkins can easily pull source code from any Git repository that the Jenkins build node can access. The GitHub plugin extends upon that integration further by providing improved bi-directional integration with GitHub.

How do I clone a Git repository using Jenkins?

There are two ways to clone the project(repository) from Github. Create a new Jenkins job called 'Clone-with-https', move to the “Source Control Management” setting, and choose “Git” options if you cannot see the Git options that mean the 'GitHub' plugin wasn't installed in the Jenkins machine.


1 Answers

Refspec defines options for the fetch operation (see here and here) whereas the branch specifier defines which branch contains the code to be built by Jenkins. In other words: Refspec only defines how the code is retrieved while branch specifier which part of the code is going to be compiled.

[Edit:] Fixed broken link to refspec

like image 182
bigge Avatar answered Oct 22 '22 02:10

bigge