Problem:

A nasty Git error that can come in different forms:

  • error: cannot lock ref
  • (unable to update local ref)
  • error: cannot lock existing info/refs
  • fatal: git-http-push failed

Solution:

git remote prune origin
git gc --prune=now