[英]Setup remote tracking in Jenkins / Git
With Jenkins, I'm checking out a project that later it builds using SBT. 有了詹金斯,我正在检查一个项目,后来它使用SBT构建。 But when it tries to execute the sbt-release plugin, it complains:
但是当它试图执行sbt-release插件时,它会抱怨:
No tracking branch is set up. Either configure a remote tracking branch, or remove the pushChanges release part
This is my Jenkins GIT plugin configuration: 这是我的Jenkins GIT插件配置:
I set those items following the guide that answers this question . 我按照回答这个问题的指南设置了这些项目。
I think the SBT-release plugin needs the remote tracking in order make a tag on the branch. 我认为SBT-release插件需要远程跟踪才能在分支上制作标签。
Assuming you want to build from master. 假设你想从master构建。
In Jenkins in GIT section select: 在GIT部分的Jenkins中选择:
Branches to build: master
also add: 还添加:
Additional Behaviours:
Check out to specific local branch: master
Build step 构建步骤
Execute Shell: 执行Shell:
git branch --set-upstream-to=origin/master master
And then add your SBT build step 然后添加您的SBT构建步骤
sbt "release with-defaults"
To solve it I have no choice but to build a command line script: 要解决它,我别无选择,只能构建一个命令行脚本:
git checkout develop || git checkout -b develop
git reset --hard origin/develop
git branch --set-upstream-to=origin/develop develop
git pull
and execute it before the SBT build. 并在SBT构建之前执行它。
the .git/config
file needs the following three lines in it: .git/config
文件中需要以下三行:
[branch "master"]
remote = origin
merge = refs/heads/master
both the other answers add those, but you can just add them manually 其他答案都添加了这些,但您可以手动添加它们
In my case, remote was missing. 在我的情况下,遥控器丢失了。 In order to solve this problem I've used the following command lines before calling Build using sbt.
为了解决这个问题,我在使用sbt调用Build之前使用了以下命令行。
git remote add origin git@foo/bar.git || git remote -v
git checkout master
git reset --hard origin/master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.