Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: cannot lock ref.. 'refs/tags' exists; cannot create 'refs/tags/

Tags:

git

github

I'm getting a strange "cannot lock ref" error when trying to pull changes from github. I've tried git gc, and looked around for similar errors but can't find a solution.

> git pull error: cannot lock ref 'refs/tags/v2.8': 'refs/tags' exists; cannot create 'refs/tags/v2.8' From github.com:k3it/qsorder  ! [new tag]         v2.8       -> v2.8  (unable to update local ref) error: cannot lock ref 'refs/tags/v2.9': 'refs/tags' exists; cannot create 'refs/tags/v2.9'  ! [new tag]         v2.9       -> v2.9  (unable to update local ref) 
like image 271
k3it Avatar asked Apr 21 '17 03:04

k3it


1 Answers

Your Git is complaining that a reference (rather than a directory) named refs/tags exists. It's not clear what would create that, but see if git rev-parse refs/tags produces a hash ID. If so, that reference needs to go away:

git update-ref -d refs/tags 

after which git fetch should work.

If git rev-parse refs/tags fails (which it should—refs/tags itself should not be a valid name) then this is not the problem and it's not clear what the actual problem is.

like image 82
torek Avatar answered Oct 03 '22 06:10

torek