Git: which is the default configured remote for branch?

前端 未结 4 753
半阙折子戏
半阙折子戏 2020-12-02 04:02

I have a remote bare repository hub. I work only in the master branch. The last sentence of this error message below makes me wonder: How do I find

4条回答
  •  情书的邮戳
    2020-12-02 04:10

    You can do it more simply, guaranteeing that your .gitconfig is left in a meaningful state:

    Using Git version v1.8.0 and above

    git push -u hub master when pushing, or:
    git branch -u hub/master

    OR

    (This will set the remote for the currently checked-out branch to hub/master)
    git branch --set-upstream-to hub/master

    OR

    (This will set the remote for the branch named branch_name to hub/master)
    git branch branch_name --set-upstream-to hub/master

    If you're using v1.7.x or earlier

    you must use --set-upstream:
    git branch --set-upstream master hub/master

提交回复
热议问题