Question

So I created a branch on one machine "slide-security-fix" pushed it to the remote, then I switched to another machine, cloned created branch and made some changes, however this branch on my local machine is now called remotes/origin/slide-security-fix. So I am trying to push this branch back to remote with applied changes:

git push origin remotes/origin/slide-security-fix

but it gives me the error:

error: src refspec remotes/origin/slide-security-fix matches more than one.
error: failed to push some refs to 'myrepo.git'

I was looking for solution and the only thing I found was to specify my remote branch explicitly:

git push origin remotes/origin/slide-security-fix:remotes/origin/slide-security-fix

But it still doesn't work

Was it helpful?

Solution

A simple solution would be

git push origin HEAD:slide-security-fix

it will tell git to push the commit currently checked out, on the branch called slide-security-fix of the remote

You could also give a proper name to the branch you're working on. You could for example do

#Create a local branch on the current commit. Call it slide-security-fix. And check it out
git checkout -b slide-security-fix

#Then push
git push origin slide-security-fix

OTHER TIPS

git push origin origin/slide-security-fix

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top