DEV Community

Michel Sánchez Montells
Michel Sánchez Montells

Posted on • Edited on

1

Git. Broken reference.

From author of the stories:

  • Where to find out old success solutions I found in the past.
  • How to help my memory.

:-)

Now I will present what works great for me fixing this not common but very annoying issue with git.

When I type

git fetch origin

I got this message:

error: cannot lock ref 'refs/remotes/origin/name-of-the-branch': unable to resolve reference 'refs/remotes/origin/name-of-the-branch': reference broken

After few googleling and stackoverflow I found this.
answer from Raja Anbazhagan

rm .git/refs/remotes/origin/name-of-the-branch
git fsck
Enter fullscreen mode Exit fullscreen mode

The second line is optional. It will only check and something a little bit scary.

;-)

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more