Claude Code can git init in home directory, causing 300GB+ storage bloat
Resolved 💬 3 comments Opened Apr 3, 2026 by codejunkie99 Closed Apr 7, 2026
Bug
Claude Code initialized a git repository in my home directory (~). Over multiple sessions, it committed files, causing .git/objects to grow to 247 GB as it tracked every file under ~ (caches, binaries, node_modules, project files, etc.).
Additionally, Kilo (an internal Claude Code component) snapshotted the .git directory, adding another 61 GB in ~/.local/share/kilo/snapshot/.
Total wasted storage: ~308 GB, all reported by macOS as "System Data."
How it likely happened
- Started a Claude Code session with
~as the working directory - Asked Claude to do something involving git
- Claude ran
git initin~without checking that it was the home directory - Subsequent sessions saw
~as a valid git repo and kept committing/tracking files - Kilo snapshotted the bloated
.gitdirectory, duplicating the problem
The repo had 99 commits and 247 GB in .git/objects.
Expected behavior
Claude Code should refuse to run git init in $HOME (or other system-level directories like /, /tmp, /usr, etc.) and warn the user instead.
Environment
- macOS (Darwin 25.3.0)
- Claude Code CLI
Workaround
rm -rf ~/.git
rm -rf ~/.local/share/kilo
This immediately reclaimed ~308 GB.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗