Jenkins Git 插件和 Refspecs
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15447661/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jenkins Git plugin and Refspecs
提问by u123
What is the difference between Refspecand Branch specifier (blank for default): in the below Jenkins job configuration:
Refspec和Branch 说明符(默认为空白)之间有什么区别:在下面的 Jenkins 作业配置中:
I have tried to set the Refspec option in the job configuration:
我试图在作业配置中设置 Refspec 选项:
+refs/heads/master:refs/remotes/origin/master
In the cloned repo on my build slave the .git/config file looks like this:
在我的 build slave 上的克隆 repo 中,.git/config 文件如下所示:
[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 fetchis not correct (read from the jenkins job configuration). Further it has no effect on the diskspace consumption.
似乎fetch的值不正确(从 jenkins 作业配置中读取)。此外,它对磁盘空间消耗没有影响。
回答by bigge
Refspecdefines options for the fetchoperation (see hereand here) whereas the branch specifierdefines which branch contains the code to be builtby Jenkins. In other words: Refspeconly defines how the code is retrieved while branch specifierwhich part of the code is going to be compiled.
Refspec定义了获取操作的选项(参见此处和此处),而分支说明符定义了哪个分支包含要由 Jenkins构建的代码。换句话说:Refspec只定义如何检索代码,而分支说明符将编译代码的哪一部分。
[Edit:] Fixed broken link to refspec
[编辑:] 修复了指向 refspec 的断开链接