I have local git branch <BRANCH_NAME>
that has no reference to upstream origin. I have made some changes to local branch and committed the same locally. I am now trying to push to remote origin.
git push --set-upstream origin <BRANCH_NAME>
it throws the error:error:src refsprc <LOCAL_BRANHC_NAME> does not match any
error: failed to push some refs to '<REMOTE_URL>
git push --set-upstream origin **HEAD:**<BRANCH_NAME>
it succeededThe difference between the commands is the prefixing of HEAD: to the "BRANCH_NAME". So my question is:
NOTE:
cat.git/HEAD
and the output was ref: refs/heads/<BRANCH_NAME>
- which is the correct one.git commit
. I had tried the commit approach as well and faced the same error.Thanks in advance
Check the ouput of a git status
: you won't be in a detached HEAD mode, but you can see if you have untracked files that could be added/committed (as I mentioned here ).
Check also the output of git branch -avv
to see both local and remote branches.
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.