Can't push local changes to an existing remote branch

前端 未结 2 1132
独厮守ぢ
独厮守ぢ 2021-02-04 17:08

There is a remote branch called \"my-remote\" that I had previously pushed to with no problem. As of today, I can\'t push and I get different errors.

First error I got w

2条回答
  •  一生所求
    2021-02-04 17:36

    If you want to push your master branch on the my-remote remote branch, the correct syntax would be:

     git push https://github.com/someurl/mybranch.git master:my-remote 
    

    (first: remote repo reference, the refspec, from git push man page)

    Regarding your first error message, if it really didn't tell you to merge, then a git pull --rebase might have been needed.
    Or at least a:

     git config --global push.default current
    

    (As mentioned in "Configure Git to Only Push Current Branch").

    If you are in the local branch 'my-remote' (which is the case, according to the command), you can make sure the upstream branch is set by making a:

    git push -u https://github.com/someurl/mybranch.git my-remote:my-remote
    

提交回复
热议问题