Search code examples
gitgithubgit-remote

Git remote branches are wrongly listed twice


If I do a git branch -a, I get my local branches listed correctly, but my remote branches are listed double... e.g.

master  
remotes/github/master  
remotes/origin/master

I think the reason for this is that I started out with a remote called github mapped to my github repository URL and then later changed its name to origin, still keeping the same URL.

If I do a git remote -v, I get the correct single name/url listing:

origin  [email protected]:username/Repo.git (fetch)
origin  [email protected]:username/Repo.git (push)

I tried removing the remote URL completely in the config file so that git remote would return nothing, but git branch -a still returned those doubled remote branches.

How do I get rid of this double listing?


Solution

  • try

    git branch -d -r remotes/github/master