question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to create .git/index.lock

See original GitHub issue

Hello @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:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:26 (5 by maintainers)

github_iconTop GitHub Comments

18reactions
muwoocommented, Jul 9, 2018

@martinfengshenxiang yeah! That’s true! gitmoji -c whill running git add . & git commit -m '' default. so I run gitmoji -g and choose N to close git add .

image

After that, just fine.

11reactions
carloscuestacommented, Sep 24, 2017

As the error messages says, this problem comes from:

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.

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 option

https://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 basic git command and I’ve fixed it by running:

rm -rf .git/index.lock

Any help is appreciated! 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found