Skip to content

Instantly share code, notes, and snippets.

@lordlycastle
Last active June 6, 2024 20:52
Show Gist options
  • Save lordlycastle/e7db769f104aa2eac258811793e151dd to your computer and use it in GitHub Desktop.
Save lordlycastle/e7db769f104aa2eac258811793e151dd to your computer and use it in GitHub Desktop.
When you get update_ref failed for ref error in git.
# Rename from 'C:/Users/Repos/phishfoodvr/.git/refs/remotes/origin/CHA/main.lock' to 'C:/Users/Repos/phishfoodvr/.git/refs/remotes/origin/CHA/main' failed. Should I try again? (y/n) n
# error: update_ref failed for ref 'refs/remotes/origin/CHA/main': couldn't set 'refs/remotes/origin/CHA/main'
$ cd $(git rev-parse --show-toplevel) # if necessary
$ rm -rf .git/refs/remotes/origin # remove all origin/*
$ mkdir .git/refs/remotes/origin # create empty origin/
$ git fetch origin # repopulate origin/*
@pgThiago
Copy link

pgThiago commented Jul 5, 2021

I wish I had money to send you a PIX.
Thank you 😍!

@balocodes
Copy link

Worked like a charm.

@otengkwame
Copy link

It works!

@Isah-Hamza
Copy link

worked clean 💯

@bdkoder
Copy link

bdkoder commented Feb 22, 2023

Cool, saved my time.

@Ab-Qadir1998
Copy link

It worked, Thanks for such an amazing solution

@lordlycastle
Copy link
Author

You guys are so kind! I'm happy it was useful for others as that was the motivation behind adding these gists.

@hyesoochoi
Copy link

life saver! thanks!

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