how to address Git error “the requested upstream branch 'upstream/master' does not exist”

后端 未结 3 1051
执念已碎
执念已碎 2021-02-07 03:16

I am attempting to follow some steps to contribute to a repository on GitHub and one of the steps is not working. The steps are here: https://github.com/wdbm/qTox/blob/master/CO

相关标签:
3条回答
  • 2021-02-07 03:55

    I had a similar problem, however git fetch didn't solve my problem. Also, in my case I found that git config --get remote.origin.fetch didn't return anything while it is suppose to

    My problem was that there was a typo in the .git/config file in the fetch line of the respective remote block (probably something I added by mistake previously). So, check if your remote entry in the .git/config file is correct, e.g.:

    [remote "origin"]
        url = https://[server]/[user or organization]/[repo].git
        fetch = +refs/heads/*:refs/remotes/origin/*
    

    You can also directly remove and re-add the remote entry

    0 讨论(0)
  • 2021-02-07 04:11

    git fetch upstream master:master: this work only when you are not on master. If you are on master, a simple git fetch upstream is enough.

    Then you can link your local master to the remote tracking branch upstream/master (which has just been fetched)

    git branch -u upstream/master master
    

    Then you can use git pull to update master.
    Again, if you are not on master, then yes, git fetch upstream master:master will work.


    Luh_ mentions also a typo issue in the refspec: see "git fetch doesn't fetch all branches".

    0 讨论(0)
  • 2021-02-07 04:12

    Try this

    git branch -u git branch --set-upstream-to=<remote>/<remote branch> branch
    
    0 讨论(0)
提交回复
热议问题