Skip to content

Instantly share code, notes, and snippets.

When attempting to initialize a new Git repository on my local machine, I encountered the following error:
-----------------------------------
| $ git init |
| error: couldn't set 'HEAD' |
-----------------------------------
Git fails to create the .git/HEAD file during repository initialization. I have verified that I have full permissions in the target directory and that no existing .git folder or file lock is present. The issue persists even after cleaning the directory and retrying git init.
I have confirmed that:
- The target directory is writable.