Getting "Another git process seems to be running in this repository" message 1st time and then works

I’ve been noticing this problem when I’ve been using git reciently (last couple of months or more).  I’ve been ignoring it because if I do the same command a 2nd time, it just works.  However, it is starting to annoy me and am worried that it is some kind of bug.

The last time this happened, stashed what I was doing, attempted a rebase, which failed, so I aborted and then popped the stashed object.  This resulted in getting the error.  I did a 2nd pop and it worked.

Is anyone else having this issue or know why this would be happening?

If this isn’t the correct location for this type of issue, please redirect me to the appropriate forum.  Thanks.

Here are the commands and their responses (with some specifics taken out).

# starting in branch 'my-branch'
$ git stash
Saved working directory and index state WIP on ...

$ git checkout develop
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.

$ git pull
From https://...

$ git checkout my-branch
Switched to branch 'my-branch'
Your branch is up to date with 'origin/my-branch'.

$ git rebase develop
First, rewinding head to replay your work on top of it...
Applying: ...
D:/Projects/Dev_Git0/wp/.git/worktrees/wp4/rebase-apply/patch:23877: trailing whitespace.
// Microsoft Visual C++ generated resource script.
D:/Projects/Dev_Git0/wp/.git/worktrees/wp4/rebase-apply/patch:23878: trailing whitespace.
D:/Projects/Dev_Git0/wp/.git/worktrees/wp4/rebase-apply/patch:23879: trailing whitespace.
#include "resource.h"
D:/Projects/Dev_Git0/wp/.git/worktrees/wp4/rebase-apply/patch:23880: trailing whitespace.

D:/Projects/Dev_Git0/wp/.git/worktrees/wp4/rebase-apply/patch:23881: trailing whitespace.

warning: squelched 23867 whitespace errors
warning: 23872 lines add whitespace errors.
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging proj/RESOURCE.RC
CONFLICT (content): Merge conflict in proj/RESOURCE.RC
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at ...
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

$ git rebase --abort

$ git stash pop
fatal: Unable to create 'D:/Projects/Dev_Git0/.git/wp4/worktrees/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.

$ git stash pop
On branch my-branch
Your branch is up to date with 'origin/my-branch'.

Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: proj/RESOURCE.RC

Dropped refs/stash@{0} (fe4ad3ed7abaf235ff839f33861b840f76a54249)


Is the error related to me using worktrees? I’m not running any other git process on my computer.

You might not be knowingly running another git process. If something else is running a process (dunno what ‘WorkTrees’ is) then you’ll get this error until that process is finished.

Hi fire-eggs,

No, I was specifically looking for a git process in Process Explorer.  No such process exists.

Worktrees allows you to use have more than one branch available fom one local repo.  See

I have the same problem, are you perhaps using visual studio?

I had the same issue and indeed I closed Visual Studio and I was able to run git command in cmdr

//clear all data from git
rm -f .git/index.lock
git reset --hard HEAD~1