Jenkins Git plugin and Refspecs

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

enter image description here

  • Git merge strategy for Agile Branching workflow
  • Github push origin master not working
  • How to find the path of the local git repository when I am possibly in a subdirectory
  • Can't get rid of "Changes not staged for commit'
  • What is the meaning of :/ (colon, forward slash) in the 2.0 version of git add --update syntax?
  • Empty all previous commits in Git?
  • 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:pass@git.internal.com/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.

  • git fatal: failed to read object xxx: Invalid argument
  • Jenkins: How to execute shell script in a Windows slave
  • git alternatives to “svn info” that can be included in a build for traceability?
  • How do I resolve conflicts with Git?
  • Expand git's autocomplete feature to plumbing commands
  • git status takes too long
  • One Solution collect form web for “Jenkins Git plugin and Refspecs”

    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

    Git Baby is a git and github fan, let's start git clone.