We’ve had reports of this on both Windows and macOS. We shipped a fix earlier, but it looks like it’s still happening on 2.6.18. I’m passing this back to the team again.
Here are a few workarounds that helped other users on macOS:
Switch Auto-Run Mode to “Ask Every Time”
Cursor Settings > Agents > Auto-Run Mode > “Ask Every Time”
A user in the original thread confirmed this fixes the .git/index.lock issue. It looks like the sandbox in auto mode is the trigger.
Disable terminal shell integration
Settings CMD + , > search for terminal.integrated.shellIntegration.enabled > set it to false
Quick cleanup when it happens
Fully quit Cursor (check Activity Monitor to make sure all processes are closed) > delete .git/index.lock > run your git commands > reopen Cursor.
Quick question: does this happen when the agent runs git commands, or when you manually run git add in the terminal while Cursor is open? This will help narrow it down and figure out what exactly is triggering it.
Thanks for the quick response. I actually stick with solution #3 most of the time.
does this happen when the agent runs git commands, or when you manually run git add in the terminal while Cursor is open? This will help narrow it down and figure out what exactly is triggering it.
It happens when I run `git add` (or other commands, like `git checkout` or `git commit`) manually. As I was interested I also tested the command inside Cursor and the agent had the same issue. FWIW I usually don’t run git commands in my agent, so I can’t say if it is the first time that it didn’t work inside the agent.
To my workflow, so you can narrow it down. I usually have multiple Cursor windows open, some of them are workspaces with 2-3 projects open. None of the agents run are running write git commands (some do use `git log`). My agent runs, I adapt the code, and on my mac terminal with oh my zsh (outside of Cursor) I run `git add` and then it fails (sometimes, but when it does it is almost persistent, unless I close Cursor).
I’m also happy to debug it together, as it is quite easy to reproduce on my end.