Git cannot lock ref 'HEAD': unable to resolve reference HEAD

后端 未结 10 1474
情深已故
情深已故 2020-12-15 16:57

I\'m trying to commit the changes to my repository but I receive the error below:

git -c diff.mnemonicprefix=false -c core.quotepath=false commit -q -F C:\\U         


        
相关标签:
10条回答
  • 2020-12-15 17:23

    I had the same problem and the only solution that I found was to navigate to the head like so :

    .git/refs/heads/branch_name

    And I deleted the head file . Then I went to the console and I used the command :

    git reset
    

    Then all the files were unstaged so add them and commit them afterwards.

    0 讨论(0)
  • 2020-12-15 17:26

    I had this problem and i used this command!

    git reset
    

    Good luck!

    0 讨论(0)
  • 2020-12-15 17:28

    If you don't mind losing your history, you can delete the .git file and then

    git init
    

    This will reinitialize your repository and you can then proceed from there

    0 讨论(0)
  • 2020-12-15 17:32

    Worked for me, into terminal enter: (branch accordingly to your desires lul)

    echo ref: refs/heads/master >.git/HEAD
    
    0 讨论(0)
提交回复
热议问题