How to push a new branch non-existing on the remote server without --set-upstream?

后端 未结 2 1955
离开以前
离开以前 2021-01-06 10:39

The scenario is that I have no repos on the remote server, just an account. Then, I run locally the following commands, where x is the user name and y is t

相关标签:
2条回答
  • 2021-01-06 11:18

    That is how i push to gerrit instance without adding remote

    git push http://localhost:8080/scm *:*
    fatal: remote error: Git repository not found
    

    But the project must exist already

    0 讨论(0)
  • 2021-01-06 11:29

    The right command is:

    git push -u origin master
    

    Then the next git push will be a simple: git push.

    See "Why do I need to explicitly push a new branch?"

    Since Git 1.8, --set-upstream is called --set-upstream-to

    You can setup a remote tracking branch in advance with:

    git branch -u origin/master master 
    

    (Then your first git push would have been a simple git push)

    0 讨论(0)
提交回复
热议问题