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

前端 未结 7 898
野性不改
野性不改 2021-01-31 02:10

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.

相关标签:
7条回答
  • 2021-01-31 02:37

    I was trying to push (/dev/somechanges) and I have a remote branch (/dev) with the same prefix when I choose a new name that is not starting with /dev it worked fine.

    0 讨论(0)
  • 2021-01-31 02:43

    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.

    0 讨论(0)
  • 2021-01-31 02:43

    This is what I tried and it worked for me.

    git remote prune origin
    
    0 讨论(0)
  • 2021-01-31 02:44

    Running

    git remote prune origin
    

    Worked for me. Not sure why this was the issue, but seems like there was a broken reference to a remote branch.

    0 讨论(0)
  • 2021-01-31 02:45

    For a quick work around you can use

    git push --delete origin 'v2.8'

    git push --delete origin 'v2.9'

    0 讨论(0)
  • 2021-01-31 02:47

    error: cannot lock ref 'refs/tags/v2.8': 'refs/tags' exists; cannot create 'refs/tags/v2.8' From github.com:k3it/qsorder

    Try deleting your local tag v2.8 and v2.9 then pull again.

    $ git tag -d v2.8 
    $ git tag -d v2.9
    
    $ git pull
    

    If you want to delete all local tags by a command:

    $ git tag | xargs git tag -d
    
    0 讨论(0)
提交回复
热议问题