I am getting this error for pull:
Your configuration specifies to merge with the ref 'refs/heads/feature/Sprint4/ABC-123-Branch' from the remote, but no such ref was fetched.
This error is not coming for any other branch.
The special thing about this branch is that it is created from the previous commit of another branch.
My config file looks like:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = <url here>
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "new-develop"]
remote = origin
merge = refs/heads/new-develop
[branch "feature/Sprint4/ABC-123-Branch"]
remote = origin
merge = refs/heads/feature/Sprint4/ABC-123-Branch
This question is related to
git
branch
bitbucket
tortoisegit
pull
This can also happen if you/someone renamed the branch.
So follow these steps (if you know that branch name is renamed)
Assuming earlier branch name as wrong-branch-name
and someone renamed it to correct-branch-name
So.
git checkout correct-branch-name
git pull
(you'll see this "Your configuration specifies..")
git branch --unset-upstream
git push --set-upstream origin correct-branch-name
git pull
(you'll not get the earlier message )
I kept running into this issue. In my case, @Jerreck's comment about case differences in the branch names was the cause of this error. Some Windows tools aren't aware of case sensitivity.
To turn off case-sensitivity in git, run this command:
git config --global core.ignorecase true
Note that this will impact more than branch names. For example, if you have "Foo.h" and "foo.h" in the same directory (not a great idea when building software for Windows) then I suspect you cannot turn off case sensitivity.
For me it was a case sensitivity issue. My local branch was Version_feature2 instead of Version_Feature2. I re-checked out my branch using the correct casing and then git pull worked.
You can easily link your local branch with remote one by running:
git checkout <your-local-branch>
git branch --set-upstream-to=origin/<correct-remote-branch> <your-local-branch>
git pull
You can edit the ~/.gitconfig
file in your home folder. This is where all --global settings are saved.
Or, use git config --global --unset-all remote.origin.url
and after run git fetch
with repository url.
This error can also be received when the origin branch name has some case issue.
For example: origin branch is team1-Team
and the local branch has been checkout as team1-team
. Then, this T
in -Team
and t
in -team
can cause such error. This happened in my case. So, by changing the local name with the origin branch's name, the error was solved.
Check if your remote branch is available to pull. I had the same issue, finally realized the remote branch was deleted by someone.
I just got the same error, when I didn't use the correct case.
I could checkout out 'integration'. Git told me to perform a git pull
to update my branch. I did that, but received the mentioned error.
The correct branch name is 'Integration' with a capital 'I'.
When I checked out that branch and pulled, it worked without problem.
I just got exactly this error when doing "git pull" when my disk was full. Created some space and it all started working fine again.
Just check if someone deleted the branch at remote.
In my case, i had deleted the original branch from which my current branch derived from. So in the .git/config file i had:
[branch "simil2.1.12"]
remote = origin
merge = refs/heads/simil2.0.5
rebase = false
the simil2.0.5 was deleted. I replaced it with the same branch name:
[branch "simil2.1.12"]
remote = origin
merge = refs/heads/simil2.1.12
rebase = false
and it worked
In my case I was simply lacking of initial commit on remote branch, so local branch wasn't finding anything to pull and it was giving that error message.
I did:
git commit -m 'first commit' // on remote branch
git pull // on local branch
If another pull just works, it means your internet wasn't connected.
For me this happened because i merged a branch dev into master using web interface and then tried to sync/pull using VSCode which was open on dev branch.(its weird that i could not change to master without getting this error.)
git pull
Your configuration specifies to merge with the ref 'refs/heads/dev'
from the remote, but no such ref was fetched.'
It makes sense that is not finding it refs/heads/dev - for me it was easier to just delete the local folder and clone again.
I was facing the same issue where my current branch was dev and I was checking out to MR branch and doing git pull thereafter. An easy workaround that I took was I created a new folder for MR Branch and did git pull there followed by git clone.
So basically I maintained different folders for pushing code to different branch.
I got a similar error when the actual cause was that my disk was full. After deleting some files, git pull
began to work as I expected.
This is a more common error now as many projects are moving their master
branch to another name like main
, primary
, default
, root
, reference
, latest
, etc, as discussed at Github plans to replace racially insensitive terms like ‘master’ and ‘whitelist’.
To fix it, first find out what the project is now using, which you can find via their github, gitlab or other git server.
Then do this to capture the current configuration:
$ git branch -vv
...
* master 968695b [origin/master] Track which contest a ballot was sampled for (#629)
...
Find the line describing the master
branch, and note whether the remote repo is called origin
, upstream
or whatever.
Then using that information, change the branch name to the new one, e.g. if it says you're currently tracking origin/master
, substitute main
:
git branch master --set-upstream-to origin/main
You can also rename your own branch to avoid future confusion:
git branch -m main
Source: Stackoverflow.com