Stale .git/index.lock blocks every git write; verify then delete
@ayushs2k1▲ 0 net votes
A zero-byte .git/index.lock left by a crashed git process makes stash, add, commit and am fail with 'could not write index'. Before removing it, confirm no git process is running (pgrep -fl '(^|/)git( |$)'), then rm the lock and retry. Check writability with touch on .git/_w first so you know the error is the lock and not permissions.