Skip to content

Instantly share code, notes, and snippets.

@libitte
Last active October 23, 2024 17:09
Show Gist options
  • Select an option

  • Save libitte/cbde168d26bc5faf9bf9fef648091b42 to your computer and use it in GitHub Desktop.

Select an option

Save libitte/cbde168d26bc5faf9bf9fef648091b42 to your computer and use it in GitHub Desktop.
FIX warning: ignoring broken ref refs/remotes/origin/HEAD

warning: ignoring broken ref refs/remotes/origin/HEAD


➜   ✗ g symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/develop
➜   ✗ g fetch --prune
➜   ✗ g gc

https://www.netroby.com/view/3864

@dlsso

dlsso commented Jun 13, 2017

Copy link
Copy Markdown

This is one of the first google results for this problem so I'd like to add a little info:

git branch -r is useful here. In my case it showed remote branches but did NOT have origin/HEAD.
In that event you can simply do git remote set-head origin main where "main" is the name of your primary (head) branch.

Running git branch -r again now shows origin/HEAD -> origin/main and the warning goes away.

Some relevant discussion here. Posts by Jeff King are especially informative.

@NoiseEee

Copy link
Copy Markdown

Thank you disso!

@redec

redec commented Sep 14, 2017

Copy link
Copy Markdown

WOOT! Thanks dlsso!

@shtratos

shtratos commented Nov 8, 2017

Copy link
Copy Markdown

Thank you!

@Jose-Solana-Globant

Copy link
Copy Markdown

Thank you very much, @disso!

@jkogara

jkogara commented Apr 7, 2018

Copy link
Copy Markdown

Thanks @disso

@vasslitvinov

Copy link
Copy Markdown

I did not want "HEAD" at all. I removed it using this:

git remote set-head origin -d

@jair-anderson-souza

Copy link
Copy Markdown

worked for me, thanks.

@fitsyu

fitsyu commented Sep 25, 2018

Copy link
Copy Markdown

thanks

@waqasajaz

Copy link
Copy Markdown

in my case primary branch name was "production"
I ran git remote set-head origin production to solve this issue.

@jtmchorse

Copy link
Copy Markdown

Disso thanks for leaving the comment, it helped me fix my error. Cheers,

@AfzalMasood11

Copy link
Copy Markdown

Thanks @dlsso

@spier

spier commented Oct 21, 2020

Copy link
Copy Markdown

👍

@mochadwi

Copy link
Copy Markdown

Thanks @dlsso

@dexter9code

Copy link
Copy Markdown

yo that's good no cap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment