Skip to content

Instantly share code, notes, and snippets.

@wdhowe
Last active May 12, 2026 08:04
Show Gist options
  • Select an option

  • Save wdhowe/1df8a74e1cc99c89bb93ae37bee165bc to your computer and use it in GitHub Desktop.

Select an option

Save wdhowe/1df8a74e1cc99c89bb93ae37bee165bc to your computer and use it in GitHub Desktop.
Fix git broken ref refs/remotes/origin/HEAD

Error seen during git commands

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

The Fix

Check remote branches

git branch -r

If the above does not display an "origin/HEAD", the HEAD can be set.

git remote set-head origin main

Where "main" is the primary/head branch.

@menagerie198

Copy link
Copy Markdown

Hello - totally naïve newby know-nothing here - please forgive my needy enquiry... I found my way here via google. I am using Obsidian (.md text editor thingy) on windows 10. My computer crashed while Obsidian was in the process of starting up/synching, and since then I have been getting the following error/warning message:
warning: ignoring broken ref refs/remotes/origin/main fatal: bad revision 'origin/main'
I have no idea what any of this means, except it refers to a file in my .git folder in Obsidian. This is related to a plugin that backs up my Obsidian files to my github.com storage. Could you give me some idea how to resolve this issue - like you were talking to a three-year old?
Many thanks

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