git pull remote branch cannot find remote ref

git pull remote branch cannot find remote ref

Be careful – you have case mixing between local and remote branch!

Suppose you are in local branch downloadmanager now (git checkout downloadmanager)

You have next options:

  1. Specify remote branch in pull/push commands every time (case sensitive):

    git pull origin DownloadManager


    git pull origin downloadmanager:DownloadManager

  1. Specify tracking branch on next push:

    git push -u origin DownloadManager

    (-u is a short form of –set-upstream)

    this will persist downloadmanager:DownloadManager link in config automatically (same result, as the next step).

  1. Set in git config default remote tracking branch:

    git branch -u downloadmanager origin/DownloadManager

    (note, since git 1.8 for branch command -u is a short form of –set-upstream-to, which is a bit different from deprecated –set-upstream)

    or edit config manually (I prefer this way):

    git config --local -e

    -> This will open editor. Add block below (guess, after master block):

    [branch downloadmanager]
            remote = origin
            merge = refs/heads/DownloadManager

and after any of those steps you can use easily:

git pull

If you use TortoiseGit:
RightClick on repo -> TortoiseGit -> Settings -> Git -> Edit local .git/config

This error happens because of local repository cant identify the remote branch at first time. So you need to do it first. It can be done using following commands:

git remote add origin url_of_your_github_project

git push -u origin master

git pull remote branch cannot find remote ref

The branch name in Git is case sensitive. To see the names of your branches that Git sees (including the correct casing), use:

git branch -vv

… and now that you can see the correct branch name to use, do this:

git pull origin BranchName 

where BranchName is the name of your branch. Ensure that you match the case correctly

So in the OPs (Original Posters) case, the command would be:

git pull origin DownloadManager

Leave a Reply

Your email address will not be published.