Another git process seems to be running in this repository

后端 未结 28 2091
梦谈多话
梦谈多话 2020-11-29 14:34

I\'m trying to learn how to use Git and have created a small project with an HTML, CSS, and Javascript file. I made a branch from my basically empty project and then made so

相关标签:
28条回答
  • 2020-11-29 14:42

    Deleting my commit message worked for me.

    rm .git/COMMIT_EDITMSG
    

    It then said.

    fatal: cannot lock ref 'HEAD': Unable to create '.git/refs/heads/[your-branch-name].lock': File exists.

    Do notice that your branch name might be different than mine. You can delete this lock file by doing;

    rm .git/refs/heads/[your-branch-name].lock
    

    Hope this helps someone.

    0 讨论(0)
  • 2020-11-29 14:42

    In case can help somebody else... I tried with command line rm -f .git/index.lock and didn't work (terminal didn't show any error). I just went directly to folder .git and delete the index.lock file.

    Note: .git folder is located in your root repository and is hidden. In mac: Cmd+Shift+. to see hidden files.

    0 讨论(0)
  • 2020-11-29 14:42

    rm -f .git/index.lock didn't help, because I had a locked file that couldn't be deleted. So, index.lock also had been captured by some application.

    In Windows I downloaded an alternative to Unlocker called Lock Hunter and deleted both files. Git captured them.

    0 讨论(0)
  • 2020-11-29 14:42

    Had the same problem using SourceTree. But there were no any index.lock file on my host at all. I've found packed-refs.lock file, and after deleting it, the problem was solved.

    0 讨论(0)
  • 2020-11-29 14:45

    For me the problem was simpler, this was in source tree so I'm not sure how much it'll apply to regular solutions but I accidentally had my master branch selected trying to make a commit rather than my uncommitted changes.

    This wouldn't normally be a problem but I had already preemptively entered a commit message so I could track what I was doing for that little sprint I was on.

    Basically, I started a commit on the uncommitted branch and was accidentally trying to start another commit on my master branch.

    0 讨论(0)
  • 2020-11-29 14:50

    Delete index.lock in here:

    <path to your repo>/.git/index.lock
    

    Also, if your repository has submodules, delete all index.lock in here as well:

    <path to your repo>/.git/modules/<path to your submodule>/index.lock
    
    0 讨论(0)
提交回复
热议问题