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

    or

    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

Answer from radistao on Stack Overflow
🌐
Reddit
reddit.com › r/git › "couldn't find remote ref master"
r/git on Reddit: "Couldn't find remote ref master"
January 6, 2021 -

[SOLVED]

Well, it's my first time dealing with this "Git interface". After using commands like:

"git init"

"git remote add origin [link of my repository on Github with that ".git" after its link]"

I tried to make that "pull" command:

"git pull origin master"

however, it's probably not working due to this warning thrown by the terminal:

"fatal: couldn't find remote ref master"

Why is this error happening? How should I fix it?

Discussions

Fatal : couldn't find remote ref
Select Topic Area Question Body Could day I am a bit stuck and after googling for hours I thought its time to put up my hand and call for help ... I forked an upstream repo Created a PR-branch to a... More on github.com
🌐 github.com
5
1
March 1, 2026
Could not find remote ref #git fetch origin
Hi, I have an issue about a build for my test. During the git clone step, the git command line git: git "fetch" "origin" "pull/id/merge:pull/id » failed, it doesn’t find my pullRequest. I don’t know if it is an error knew with bitrise or it’s an other problem… More on discuss.bitrise.io
🌐 discuss.bitrise.io
3
1
March 28, 2017
Git Error when rebuilding app - couldn’t find remote ref refs/heads/tests-passed
Hi guys, I´m getting this error when I rebuild the app Pups::ExecError: cd /var/www/discourse && sudo -H -E -u discourse bash -c ’ set -o errexit if [ $(git rev-parse --is-shallow-repository) == “true” ]; then git remote set-branches --add origin main git remote set-branches origin ... More on meta.discourse.org
🌐 meta.discourse.org
8
0
November 20, 2024
fatal: coudn't find remote ref master
Having trouble pulling updates from master? (fatal: coudn't find remote ref master) Try the following to fix your remote/upstream references: git pull origin git checkout -b main git branch mai... More on github.com
🌐 github.com
3
July 22, 2020
People also ask

Why does Git show couldn't find remote ref master?
Many repositories have migrated from master to main as the default branch. If the repository uses main instead of master, attempting to pull master will result in this error. Updating the command to use the correct branch resolves the issue.
🌐
golinuxcloud.com
golinuxcloud.com › home › devops › git › git fix: fatal: couldn't find remote ref main (complete guide)
Git Fix: fatal: couldn't find remote ref main (Complete Guide) ...
What causes the error 'fatal: couldn't find remote ref main' in Git?
This error occurs when Git cannot locate the specified branch on the remote repository. It typically happens when the branch does not exist, the repository still uses the master branch instead of main, or when the local repository references an incorrect or outdated remote branch.
🌐
golinuxcloud.com
golinuxcloud.com › home › devops › git › git fix: fatal: couldn't find remote ref main (complete guide)
Git Fix: fatal: couldn't find remote ref main (Complete Guide) ...
Why does git pull origin main show couldn't find remote ref main?
This usually happens when the remote repository does not contain a branch named main. Many older repositories still use the master branch as the default branch. Running `git branch -r` will show which branches actually exist on the remote repository.
🌐
golinuxcloud.com
golinuxcloud.com › home › devops › git › git fix: fatal: couldn't find remote ref main (complete guide)
Git Fix: fatal: couldn't find remote ref main (Complete Guide) ...
🌐
Bitrise
discuss.bitrise.io › question & answer › builds
Could not find remote ref #git fetch origin - Builds - Bitrise Discussions
March 28, 2017 - Hi, I have an issue about a build for my test. During the git clone step, the git command line git: git "fetch" "origin" "pull/id/merge:pull/id » failed, it doesn’t find my pullRequest. I don’t know if it is an error k…
🌐
Atlassian Support
support.atlassian.com › bitbucket-data-center › kb › couldnt-find-remote-ref-error-in-bitbucket
"Couldn't find remote ref" error in Bitbucket | Bitbucket Data Center | Atlassian Support
April 24, 2025 - /usr/local/bin/git fetch ... refs/heads/bug/ARGUS-23284 fatal: The remote end hung up unexpectedly · This can happen when are using a fork-merge like workflow for your development project, so all your developers always have an up-to-date master in their own fork and ...
🌐
DevErrors
deverrors.com › home › git › fatal: couldn't find remote ref
Deverrors
May 28, 2026 - Fix Git's "fatal: couldn't find remote ref" error caused by deleted, renamed, or stale branch refs. Run git fetch --prune and check the exact branch name.
Find elsewhere
🌐
GoLinuxCloud
golinuxcloud.com › home › devops › git › git fix: fatal: couldn't find remote ref main (complete guide)
Git Fix: fatal: couldn't find remote ref main (Complete Guide) | GoLinuxCloud
March 15, 2026 - This typically happens when the branch name is incorrect, the branch does not exist on the remote server, or the repository configuration is outdated. This issue commonly appears during commands such as git pull, git fetch, or git clone when ...
🌐
Laracasts
laracasts.com › discuss › channels › code-review › fatal-couldnt-find-remote-ref-main
fatal: couldn't find remote ref main
I am using gitlab and the branch is called main · Like Reply · Sinnbeck · 4 years ago · Level 102 · ReplyReport Spam · @davy_yg So check your remote git remote -v · Like Reply · davy_yg · OP · 4 years ago · Level 27 · ReplyReport Spam · [advancew@sjc02 zws_framework_2]$ git remote -v origin .git/ (fetch) origin .git/ (push) [advancew@sjc02 zws_framework_2]$ git pull origin main fatal: couldn't find remote ref main ·
🌐
Tabby Data
tabbydata.com › home › why does the error fatal: couldn’t find remote ref occur and how can i fix it?
Why Does the Error Fatal: Couldn't Find Remote Ref Occur and How Can I Fix It?
December 24, 2025 - To resolve the “Fatal: Couldn’T Find Remote Ref” error, consider the following troubleshooting steps: Verify Branch Name: Double-check the exact name of the branch or tag you want to push or pull. Use `git branch -r` to list remote branches and confirm the correct name.
🌐
Medium
medium.com › @DulanaSenavirathna › how-to-fix-cannot-lock-ref-refs-remotes-origin-branchname-during-a-git-fetch-c8daf7aac56c
How to Fix: Cannot Lock Ref ‘refs/remotes/origin/<branchName>’ During a Git Fetch? | by Dulana Senavirathna | Medium
November 27, 2024 - In this article, we’ll dive into the problem, its causes, and how to resolve it with practical steps. By the end, you'll also learn how to keep your Git repository clean and conflict-free in the future. ... error: cannot lock ref 'refs/remotes/origin/<branchName>': unable to resolve reference error: failed to fetch some references from '<remote-repo>'
🌐
Discourse
meta.discourse.org › support › self-hosting
Git Error when rebuilding app - couldn’t find remote ref refs/heads/tests-passed - Self-hosting - Discourse Meta
November 20, 2024 - Hi guys, I´m getting this error when I rebuild the app Pups::ExecError: cd /var/www/discourse && sudo -H -E -u discourse bash -c ’ set -o errexit if [ $(git rev-parse --is-shallow-repository) == “true” ]; then git remote set-branches --add origin main git remote set-branches origin tests-passed git fetch --depth 1 origin tests-passed else git fetch --tags --prune-tags --prune --force origin fi ’ failed with return # When I execute this: git fetc...
🌐
GitHub
github.com › openshift-evangelists › kbe › issues › 55
fatal: coudn't find remote ref master · Issue #55 · openshift-evangelists/kbe
July 22, 2020 - Having trouble pulling updates from master? (fatal: coudn't find remote ref master) Try the following to fix your remote/upstream references: git pull origin git checkout -b main git branch main -u origin/main git remote set-head origin ...
Author   openshift-evangelists
🌐
GitHub
github.com › readthedocs › readthedocs.org › issues › 10787
git fetch failed with "couldn't find remote ref" when version was "origin/master" instead of master · Issue #10787 · readthedocs/readthedocs.org
October 2, 2023 - git fetch origin --force --prune --prune-tags --depth 50 refs/heads/origin/master:refs/remotes/origin/origin/master fatal: couldn't find remote ref refs/heads/origin/master
Author   readthedocs
🌐
Saywebsolutions
saywebsolutions.com › blog › git-github-error-fatal-couldnt-find-remote-ref-master
Git Error | Say Web Solutions
October 8, 2020 - # Switch to "master" branch git checkout master # Rename "master" branch to "main" git branch -m master main # Get latest commits and branches from remote git fetch # Remove existing connection with "master" git branch --unset-upstream # Create connection with new "main" branch git branch -u origin/main
🌐
Arch Linux Forums
bbs.archlinux.org › viewtopic.php
[SOLVED] "fatal: Couldn't find remote ref HEAD" / AUR Issues, Discussion & PKGBUILD Requests / Arch Linux Forums
December 5, 2019 - aur ssh://aur@aur.archlinux.or... by convenience stores... that weren't on the way home." ... aur.archlinux.org/daemon-engine.git is an empty repository, which is why it can't find remote ref master....
🌐
Araqev
araqev.com › home › why am i seeing ‘fatal: couldn’t find remote ref’? understanding this common git error
Why Am I Seeing 'fatal: couldn't find remote ref'? Understanding This Common Git Error
April 13, 2025 - To resolve the `fatal: couldn’t find remote ref` error, follow these troubleshooting steps: Verify the Remote URL: Check that the remote URL is correct by running: “`bash git remote -v “` Ensure that the URL points to the correct repository. Check Branches and Tags: Use the following ...