Rodolfo Pereira
Rodolfo Pereira

Reputation: 31

Jenkins - Git Publisher - Error The destination refspec neither matches an existing ref on the remote nor

I'm using the Git Publisher feature of Git Plugin of Jenkins to push my build to another repository, but the following error appears:

"ERROR: Failed to push branch master to github hudson.plugins.git.GitException: Command "git.exe push https://github.com/rodolfoprr/teste2.git HEAD:master" returned status code 1: stdout: stderr: error: unable to push to unqualified destination: master 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 'github.com/rodolfoprr/teste2.git'"

My configuration:

Source Code Management

Git

Repository URL: git//github.com/rodolfoprr/teste.git

Credentials: none

Repository URL: https://github.com/rodolfoprr/teste2.git

Credentials: rodolfoprr/** (github)

Name: github

Git Publisher

Push Only If Build Succeeds checked

Branch to push: master

Target remote name: github

Upvotes: 1

Views: 3408

Answers (1)

Rodolfo Pereira
Rodolfo Pereira

Reputation: 31

I solved the problem:

In the first build, I added a "build step" -> "execute shell":

git checkout master

The following builds, I deleted this step.

This link helped me: http://thingsyoudidntknowaboutjenkins.tumblr.com/post/23596855946/git-plugin-part-3

Upvotes: 2

Related Questions