Git rename from index.lock to index failed

前端 未结 16 2000
遇见更好的自我
遇见更好的自我 2020-11-30 06:42

Using the GitHub Windows client I did a sync to pull remote changes to my local machine, but before finishing the sync, I ran out of disk space and the sync failed.

相关标签:
16条回答
  • 2020-11-30 06:45

    This is caused when antivirus or OS defender (for example Windows Defender) is running. The solution: turn off antivirus for several minutes make your add, commit and push. Turn on antivirus.
    It will work.

    0 讨论(0)
  • 2020-11-30 06:47

    I got this error several times in a row when running git reset HEAD in a project stored in a Google Drive folder, but after a few minutes the problem went away.

    0 讨论(0)
  • 2020-11-30 06:48

    Looks like the following process had a lock on the .git\index file:

    ssh-agent.exe
    C:\Users\Tom\AppData\Local\GitHub\PortableGit_8810fd5c2c79c73adcc73fd0825f3b32fdb816e7\bin\ssh-agent.exe
    

    I killed the process and ran git reset HEAD and looks like I'm back to normal now.

    0 讨论(0)
  • 2020-11-30 06:51

    To discard local changes, go

    git reset HEAD
    

    Then checkout your old commit, delete the new one, and pull again.

    git checkout "hashOld"
    git branch -d "hashNew"
    git pull
    
    0 讨论(0)
  • 2020-11-30 06:52

    In my case, this was caused by using the same Git repo from both admin and non-admin command prompts. When last git pull was from admin cmd, the index was created by it, and then non-admin cmd had insufficient permissions to modify it.

    My solution was re-creating the index (while keeping the worktree intact):

    del .git\index
    git reset --mixed head
    
    0 讨论(0)
  • 2020-11-30 06:55

    In my case I had to close the VS code which I opened with code . from a WSL Ubuntu terminal.

    0 讨论(0)
提交回复
热议问题