[BUG] Claude Desktop App spawns git subprocess every ~10s causing index.lock conflicts with concurrent git operations

Resolved 💬 6 comments Opened Mar 21, 2026 by axel-winter-takkt Closed May 24, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The Claude Desktop App spawns a git subprocess every ~10 seconds to poll repository status for its UI. This creates an index.lock file for ~100ms on each cycle. When a user runs a git operation (e.g. git commit with a lint-staged pre-commit hook) at the same time, it fails with:

fatal: Unable to create '.git/index.lock': File exists.
Another git process seems to be running in this repository.

This causes intermittent, hard-to-reproduce CI failures and local commit errors.

What Should Happen?

Either the polling interval should be configurable (e.g. via settings.json), or Claude should use GIT_OPTIONAL_LOCKS=0 when spawning git subprocesses so the index lock is not acquired for read-only status queries.

Error Messages/Logs

fatal: Unable to create '.git/index.lock': File exists.
Another git process seems to be running in this repository.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually if that is the case.

Verified via fs_usage — lock is created and released every ~10 seconds:

12:46:21.137351  open  (RWC__E_____X___)  .git/index.lock   git.127178
12:46:21.230864  unlink                   .git/index.lock   git.127178
12:46:31.126905  open  (RWC__E_____X___)  .git/index.lock   git.127364
12:46:31.226854  unlink                   .git/index.lock   git.127364

Parent process identified via polling loop — confirmed to be Claude Desktop App:

git pid=16247 → parent: 3041 /Applications/Claude.app/Contents/MacOS/Claude
git pid=16619 → parent: 3041 /Applications/Claude.app/Contents/MacOS/Claude
git pid=16998 → parent: 3041 /Applications/Claude.app/Contents/MacOS/Claude

Steps to Reproduce

  1. Open a git repository in Claude Desktop App
  2. Run the following polling loop in a terminal:
while true; do
  for pid in $(pgrep -x git 2>/dev/null); do
    ppid=$(ps -p $pid -o ppid= 2>/dev/null | tr -d ' ')
    parent=$(ps -p $ppid -o pid=,comm=,args= 2>/dev/null)
    echo "git pid=$pid → parent: $parent"
  done
  sleep 0.05
done
  1. Observe that /Applications/Claude.app is the parent of git subprocesses spawned every ~10 seconds
  2. Run git commit with a pre-commit hook (e.g. lint-staged) — intermittently fails with index.lock error

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.80

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗