# fatal: Unable to create '.git/index.lock': File exists.

- **ID:** `git/commit-not-possible-because-index-is-locked`
- **Domain:** git
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

A previous git command crashed or is still running, leaving the index.lock file, which prevents any new write operations.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| git 2.30.0 | active | — | — |
| git 2.39.0 | active | — | — |
| git 2.42.0 | active | — | — |

## Workarounds

1. **Remove the lock file manually: rm -f .git/index.lock** (95% success)
   ```
   Remove the lock file manually: rm -f .git/index.lock
   ```
2. **Check for hanging git processes: ps aux | grep git, then kill them before removing the lock file.** (85% success)
   ```
   Check for hanging git processes: ps aux | grep git, then kill them before removing the lock file.
   ```
3. **If using Windows, use del .git\index.lock from the repository root.** (90% success)
   ```
   If using Windows, use del .git\index.lock from the repository root.
   ```

## Dead Ends

- **** — Destroys all commit history and branches; overkill for a simple lock file issue. (95% fail)
- **** — The lock file persists, so the same error occurs again. (100% fail)
- **** — Does not remove the lock file; may lose uncommitted changes without fixing the issue. (80% fail)
