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
🌐
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…
Discussions

"Couldn't find remote ref master"

Is the remote branch actually called "master"?

More on reddit.com
🌐 r/git
23
12
January 6, 2021
git fetch failed with "couldn't find remote ref" when version was "origin/master" instead of master
Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. ... There was an error while loading. Please reload this page. ... git fetch failed with "couldn't find remote ref" when version was "origin/master" instead of master#10787 More on github.com
🌐 github.com
2
October 2, 2023
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
git pull from remote but no such ref was fetched? - Unix & Linux Stack Exchange
I have a git mirror on my disk and when I want to update my repo with git pull it gives me error message: Your configuration specifies to merge with the ref '3.5/master' from the remote, but no s... More on unix.stackexchange.com
🌐 unix.stackexchange.com
March 1, 2013
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 show remote ref does not exist?
The remote ref does not exist error occurs when a Git command references a branch that is not available on the remote repository. This may happen if the branch was deleted, renamed, or never pushed to the remote server.
🌐
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) ...
🌐
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?

🌐
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 - Unable to view the Diff and Commits tab in a Pull request because merge between a branch in forked repository and branch in Main repository gives error Couldn't find remote ref <ref> ... DEBUG [http-nio-7990-exec-7] <username> @1Q1D2K7x626x1237485x0 jdsoxe 10.0.16.128,127.0.0.1 "GET /rest/api/latest/projects/<PROJECT-KEY>/repos/<repo-slug>/pull-requests/<ID>/changes HTTP/1.1" c.a.s.i.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 500 com.atlassian.bitbucket.scm.CommandFailedException: '/usr/local/bin/git fetch /var/atlassian/application-data/stash/shared/data/repositories/1820 <branch-ref>:' exited with code 128 saying: fatal: Couldn't find remote ref <branch-ref> fatal: The remote end hung up unexpectedly at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onError(DefaultCommandExitHandler.java:47) at java.lang.Thread.run(Thread.java:748) ...
🌐
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
🌐
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.org/daemon-engine.git (fetch) aur ssh://aur@aur.archlinux.org/daemon-engine.git (push) origin git@gitea.com:PopeRigby/daemon-engine-aur.git (fetch) origin git@gitea.com:PopeRigby/daemon-engine-aur.git (push) "I even found myself driving 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.
Find elsewhere
🌐
Laracasts
laracasts.com › discuss › channels › code-review › fatal-couldnt-find-remote-ref-main
fatal: couldn't find remote ref main
Can't understand this error message: fatal: couldn't find remote ref main ... [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
🌐
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 ...
🌐
YouTube
youtube.com › sagar s
fatal couldn't find remote ref master main - Error in git - git subtree - pull or fetch error - YouTube
Join this channel to get access to perks:https://www.youtube.com/channel/UCoSpmr2KNOxjwE_B9ynUmig/joinMy GearCamera - http://amzn.to/2tVwcMPTripod - http://a...
Published   April 1, 2022
Views   18K
🌐
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...
🌐
Buildkite
forum.buildkite.community › general
Fatal: couldn't find remote ref master - General - Buildkite Community Forum
March 23, 2023 - Hi, I tried to setup a buildkite plan for my repo in github. When I run a new build , I see this error: git fetch -v --prune – origin master POST git-upload-pack (317 bytes) fatal: couldn’t find remote ref master ⚠ Warning: Checkout failed! exit status 128 (Attempt 3/3) 🚨 Error: exit status 128 Not sure why I am getting this error.
🌐
GitHub
github.com › kubernetes › test-infra › issues › 19910
Unable to fetch/merge certain pull requests · Issue #19910 · kubernetes/test-infra
November 10, 2020 - What happened: Some presubmits are failing because they either: can't fetch a given PR's ref $ git fetch https://github.com/kubernetes/kubernetes.git pull/96426/head fatal: couldn't find remote ref pull/96426/head can fetch a ref, but it...
Author   kubernetes
🌐
Developer Community
developercommunity.visualstudio.com › t › fatal:-couldnt-find-remote-ref-refspul › 10775847
fatal: couldn't find remote ref refs/pull/3434/merge Git fetch ...
Skip to main content · Visual Studio · Guidelines Problems Suggestions Code of Conduct · Downloads · Visual Studio IDE Visual Studio Code Azure DevOps Team Foundation Server Accounts and Subscriptions · Subscriber Access · Microsoft Security Azure Dynamics 365 Microsoft 365 Microsoft ...
🌐
A Girl Among Geeks
agirlamonggeeks.com › home › how can i fix the fatal: couldn’t find remote ref error in git?
How Can I Fix the Fatal: Couldn't Find Remote Ref Error in Git?
July 4, 2025 - To resolve the `Fatal: Couldn’t Find Remote Ref` error, proceed with the following methodical steps: Verify Branch or Tag Name: Confirm the exact name of the remote branch or tag you want to access. Use git ls-remote <remote> to list all references on the remote.
🌐
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
🌐
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.