You Should Be Versioning Your ~/.claude Config
Source: Dev.to
What to version
Based on the official docs, these files and directories are worth versioning:
CLAUDE.mdsettings.jsonskills/**/SKILL.mdagents/.mdcommands/.mdstatusline.sh
.gitignore
Claude Code generates transient data that should be ignored. Add the following patterns to your .gitignore:
# Credentials
.credentials.json
credentials.json
# Internal state
.claude.json
.claude.json.backup.*
security_warnings_*.json
stats-cache.json
mcp-needs-auth-cache.json
# Session data
history.jsonl
backups
cache
debug
file-history
paste-cache
session-env
shell-snapshots
# Agent and team state
plans
plugins
tasks
teams
todos
# Telemetry
statsig
telemetry
usage-data
# IDE integration
ide/
Projects directory
The projects/ directory contains per‑project auto‑memory and conversation logs. Since Claude Code now supports memory per project, you may want to keep the directory in version control but ignore the large log files:
projects/**/*.jsonl
projects/**/*.txt
Initialize the repository and push to GitHub
cd ~/.claude
git init
git add .gitignore CLAUDE.md settings.json
git add skills/ agents/ commands/ statusline.sh 2>/dev/null
git commit -m "feat: initial claude config"
gh repo create claude-config --private --source=. --push
That’s it—your Claude configuration is now version‑controlled and safely stored in a remote repository.