简体   繁体   中英

Jenkins - Create Git branch on build

I have a Jenkins build and on completion I wish to create a branch in the remote repository for the release.

I have the git publish setup like this: 在此处输入图片说明

But when I run it tagging seems to go OK but the branching gives:

ERROR: Failed to push branch RELEASE-5 to jsched
 hudson.plugins.git.GitException: Command "git.exe push 
 https://myid@git.server:9443/scm/win/jsched.git HEAD:RELEASE-5" returned status code 1:

 stderr: error: unable to push to unqualified destination: RELEASE-5
  The destination refspec neither matches an existing ref on the remote nor
  begins with refs/, and we are unable to guess a prefix based on the source ref.
 error: failed to push some refs to 'https://myid@git.server:9443/scm/win/jsched.gitt'

What am I doing wrong?

You are pushing your local RELEASE-ID branch to the remote, but the problem is that since it's a newly created branch it has no upstream defined, thus git does not know where to push the commits.

If you where doing this "by hand" you would have told git to use remote/RELEASE-ID as upstream. Jenkins interface does not allow you to define such behavior. Maybe you can achieve something similar with a script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM