Unable to create .git/index.lock
See original GitHub issueHello @carloscuesta 😎!
Since a while now, every time I commit (I have the pre-commit hook installed), after it, I get this message:
ERROR: fatal: Unable to create '/Projects/pathname/.git/index.lock': File exists.
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
I’ve tried removing and installing the pre-commit hook, removed gitmoji-cli completely and updated to the most recent version - nothing helps. I encounter the same problem without pre-commit hook and just using the gitmojicommand. When I just commit normally (without gimoji) everything works fine 👌 .
Any ideas?
KR
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:26 (5 by maintainers)
Top Results From Across the Web
Ask Question
fatal: Unable to create '/path/my_proj/.git/index.lock': File exists. If no other git process is currently running, this probably means a ...
Read more >Understanding and Using Git's index.lock File
1fatal: Unable to create '.git/index.lock': File exists. This error alludes to the creation of an index.lock file within your hidden .git ...
Read more >Git Error: Unable to create index.lock | The First Byte
Here's an error I recently came accross in Git when trying to push a commit. If Git is giving you something about being...
Read more >Git - How to Solve `'git/index.lock': File exists` Error in ...
1)-Open terminal . 2)-Open project file location. 3)-Rum command - defaults write com.apple.finder AppleShowAllFiles YES. Now u can see hidden ...
Read more >fatal: Unable to create, git/index.lock': File exists
Open terminal & go to the path where your project is. · Type ls command and check if there is a .git folder....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@martinfengshenxiang yeah! That’s true!
gitmoji -c
whill runninggit add . & git commit -m ''
default. so I rungitmoji -g
and chooseN
to closegit add .
After that, just fine.
As the error messages says, this problem comes from:
And basically this happens when a git process is killed therefore the lock file is left over.
I’ve been investigating and I haven’t found a solution yet. It’s really weird because it’s hard to reproduce the error. IMHO I think the issue is related with use of the
hook
optionhttps://github.com/carloscuesta/gitmoji-cli/blob/ea99b5166c2d642d72be7f536d69127cecb99409/src/gitmoji.js#L108-L113
It really never happened to me, at least with
gitmoji-cli
. I’ve faced this issue (when cancelling a pull, commit etc.) while using the basicgit
command and I’ve fixed it by running:Any help is appreciated! 👍