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

  1. Started a Claude Code session with ~ as the working directory
  2. Asked Claude to do something involving git
  3. Claude ran git init in ~ without checking that it was the home directory
  4. Subsequent sessions saw ~ as a valid git repo and kept committing/tracking files
  5. Kilo snapshotted the bloated .git directory, 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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗