99

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 such ref was fetched.

It also gives me:

  1ce6dac..a5ab7de  3.4/bfq    -> origin/3.4/bfq
  fa52ab1..f5d387e  3.4/master -> origin/3.4/master
  398cc33..1c3000a  3.4/upstream-updates -> origin/3.4/upstream-updates
  d01630e..6b612f7  3.7/master -> origin/3.7/master
  491e78a..f49f47f  3.7/misc   -> origin/3.7/misc
  5b7be63..356d8c6  3.7/upstream-updates -> origin/3.7/upstream-updates
  636753a..027c1f3  3.8/master -> origin/3.8/master
  b8e524c..cfcf7b5  3.8/misc   -> origin/3.8/misc
  * [neuer Zweig]     3.8/upstream-updates -> origin/3.8/upstream-updates

When I run make menuconfig it gives me Linux version 3.5.7? What does this mean? How can I update my repo?

2

12 Answers 12

74

Check the branch you are on (git branch), check the configuration for that branch (in .../.git/config), you probably are on the wrong branch or your configuration for it tells to merge with a (now?) non-existent remote branch.

4
  • 30
    To remove non-existent remote branch references in your local repository, use git remote prune origin.
    – jevon
    Commented Apr 9, 2014 at 2:53
  • 8
    Another way to "check the configuration" for a branch is: git branch -vv. That displays the branch's associated "remote".
    – offby1
    Commented Oct 14, 2014 at 19:11
  • 2
    renamed the branch? don't forget to update the remote branch reference in .git/confg Commented Mar 5, 2021 at 18:15
  • In my case there was indeed a naming problem with remote branch. I just did git checkout main, followed git pull and checked out the branch with the right name.
    – vasigorc
    Commented Aug 31 at 23:48
38

In my case, my local branch was not set to track the remote branch. I had to manually run:

git pull origin remotebranch

Then next time you do a push do "git push -u" to set up correct tracking.

1
  • The same goes for when you first clone an empty repo ie created using git init --bare Commented Mar 25, 2015 at 23:21
15

In my case, my local branch and remote branch had different capitalization.

To resolve this I deleted my local branch $ git branch -d branch-name, then checked out the remote branch again using $ git fetch and $ git checkout Branch-name.

3
  • Its clean, simple and working fine. Thank you. Commented Jun 15, 2015 at 9:47
  • I got this error in cmd line. Tried SmartGit with a rebase and got past it. Commented Nov 4, 2016 at 17:26
  • 1
    Do this once instead of delete branch and re-checkout branch every single time: Correct capitalization in your /.git/config
    – wz366
    Commented May 30, 2018 at 22:18
4

In my case I had to call the following commands manually:

git fetch origin
git merge origin/master

(c) https://stackoverflow.com/a/13800341/741782

3

It's possible that someone else on your team simply merged your branch and deleted it (commonly done after merging). You can make the branch on the repo and try again. It's happens to me at my company every once in a while (bitbucket defaults to merge and delete).

3

I had the same error when running out of disk space. After resizing the volume, the error was gone.

3

If the branch is gone,

$ git status
On branch blah_gone_now
Your branch is based on 'origin/1234/blah_gone_now', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)

$ git branch --unset-upstream

Then checkout master or whatever you need

2

For me, the problem was also capitalization of the remote's name, but lower case on the local working copy. I fixed this by reestablishing the upstream:

git branch --set-upstream-to=origin/UPPER-case-branch

This gave me a successful message:

Branch 'upper-case-branch' set up to track remote branch 'UPPER-case-branch' from 'origin'.

Afterwards, the git pull worked normally.

1

In my case (the usual caveat), I already had a branch of the appropriate name so I only had to add remote = origin to my .git/config:

[branch "sparql"]
    merge = refs/heads/sparql
    remote = origin # <-- added
0

I got this issue due to a casing problem that manifests itself on Windows.

My Git config looked like:

[branch "Bug/some_branch"]
  remote = origin
  merge = refs/heads/Bug/some_branch

On the server, both "Bug" and "bug" existed as part of multiple branches. Windows can only hold one of these at a time though, due to the file system mapping. Therefore, I manually updated my config to match the server version, which actually solved the pull issue:

[branch "Bug/some_branch"]
  remote = origin
  merge = refs/heads/bug/some_branch
0

This may occur if someone has renamed the remote branch.

If you need to resolve it without manually determine the new branch to pull from, try this:

default_branch=$(git remote show origin | awk '/HEAD branch/ { print $3 }')
git branch -m $default_branch
git branch -u origin/$default_branch
git pull

This will get the head branch name from origin, rename the current local branch, set it to track from the remote branch, and then pull.

0

This one is old but if someone lands into this page,

the solution that worked for us was to check the casing, git is case sensitive.

check .git/config file to match your repository branch name.

1
  • Welcome to U&L, your answer is same as @Feckmore's
    – Archemar
    Commented May 14, 2021 at 8:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .