문제

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

도움이 되었습니까?

해결책

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

다른 팁

git push origin origin/slide-security-fix

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top