How do you remove an invalid remote branch reference from Git?

In my current repo I have the following output:

$ git branch -a
* master
  remotes/origin/master
  remotes/public/master

I want to delete remotes/public/master from the branch list:

$ git branch -d remotes/public/master
error: branch 'remotes/public/master' not found.

Also, the output of git remote is strange, since it does not list public:

$ git remote show 
origin

How can I delete ‘remotes/public/master’ from the branch list?

Update, tried the git push command:

$ git push public :master
fatal: 'public' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

13 s
13

Leave a Comment