Why is git pull showing new branches all the time?

I’m using git bash for Windows:

$ git version
git version 1.8.0.msysgit.0

Everything has been working fine for months, I’ve been gradually getting used to how git works, then all of a sudden, git pull is retrieving a number of “new” branches each time I try to pull:

  • Endless conflict between remote git repo and svn
  • trying to build apk for android and get npm errors
  • How to setup a Cron job to do a Git commit
  • Git stash issue
  • How do I check if a repository is bare?
  • How to make/transform existing directory into git submodule?
  • me@MYPC /d/Projects/MyProject (master)
    $ git pull
    From github.com:ClientUsername/RepoName
     * [new branch]      branch1 -> origin/branch1
     * [new branch]      branch2 -> origin/branch2
    Already up-to-date.
    
    me@MYPC /d/Projects/MyProject (master)
    $ git pull
    From github.com:ClientUsername/RepoName
     * [new branch]      branch1 -> origin/branch1
     * [new branch]      branch2 -> origin/branch2
    Already up-to-date.
    

    Have I configured something incorrectly? Is this normal behavior?


    EDIT

    After some helpful comments, I deleted the branch files from .git\refs\remotes\origin. I tried to pull again and got the following:

    me@MyPC /d/Projects/MyProject (master)
    $ git pull
    From github.com:ClientUsername/RepoName
     * [new branch]      Branch1 -> origin/Branch1
     * [new branch]      Branch2 -> origin/Branch2
     * [new branch]      branch1 -> origin/branch1
     * [new branch]      branch2 -> origin/branch2
    Already up-to-date.
    me@MyPC /d/Projects/MyProject (master)
    $ git pull
    From github.com:ClientUsername/RepoName
     * [new branch]      Branch1 -> origin/Branch1
     * [new branch]      Branch2 -> origin/Branch2
    Already up-to-date.
    

    The only difference being the case of the branch names?

  • Code Tidy vs Source Control (Monotone or Git)
  • Hudson: returned status code 141: fatal: write error: No space left on device
  • issue with forking an unstable repo on Github
  • Use custom NuGet feed in Visual Studio Online
  • How to “git show” a merge commit with combined diff output even when every changed file agrees with one of the parents?
  • git clone fails with “index-pack” failed?
  • 3 Solutions collect form web for “Why is git pull showing new branches all the time?”

    I could reproduce the behavior by having a branch not listed in .git/packed_refs and renaming its file in .git/refs/remotes/origin to the same but different case. (on NTFS filesystem). And it is cured by renaming back.

    Guess if you could rename to the form that matches the remote name, it would be a fix for you.

    Thinking more, and using the first form after edit:

    You must have two branches with similar name just differing in case on remote!

    And the problem is because they want to create the same file. You must fix it on the remote, by renaming one of the similar-named branches.

    As you can see here:

    * [new branch]      Branch1 -> origin/Branch1
    * [new branch]      Branch2 -> origin/Branch2
    * [new branch]      branch1 -> origin/branch1
    * [new branch]      branch2 -> origin/branch2
    

    You have 4 branches and pairs of them have the same name with different upper/lowercase. This can’t be mirrored on Windows since branches are stored as files and you can not have two files Branch1 and branch1 in the same folder.

    To fix that, remove one of these, by running git push origin :Branch1 and the same for Branch2.

    Had a similar issue, problem was with an existing local folder not matching the name in the remote server due to case-sensitive differences.
    What worked for me was going to

    .git/refs/remotes/origin
    

    where you can find the affected branch folder name and either rename it to the name suggested in the *[new branch] line OR delete it and pull again, the pull will re-create the folder in the correct filesystem case.

    Although from your last edit it looks like in the remote server you have both folders (ie Branch1 and branch1) so I will double check which one is the correct folder and delete the remote wrong one, then make sure the folder name is matching the one in your local.

    Git Baby is a git and github fan, let's start git clone.