Multi-Machine Config & Backup
Syncing your Claude Code configuration across multiple machines
PDF
← All cards
What stays local vs what is shareable
| Local only | Shareable |
|---|---|
settings.local.json | agents/, commands/ |
| API keys, tokens | hooks/, rules/, skills/ |
| Session history | settings.template.json |
.env with secrets | CLAUDE.md (team conventions) |
Golden rule: never commit API keys or credentials. Use template files with ${VAR_NAME} placeholders for sensitive values.
Git + symlinks strategy (recommended)
Approach inspired by Martin Ratinaud (504 tested sessions) and brianlovin/claude-config.
# 1. Create a private repo for global configmkdir ~/claude-config-backup && cd ~/claude-config-backupgit init
# 2. Create symlinks (changes are automatic)ln -s ~/.claude/agents ./agentsln -s ~/.claude/commands ./commandsln -s ~/.claude/hooks ./hooksln -s ~/.claude/skills ./skills
# 3. Template without secretscp ~/.claude/settings.json ./settings.template.json# Replace values with ${ANTHROPIC_API_KEY} etc.
# 4. Strict .gitignoreecho "settings.json\nmcp.json\nprojects/" > .gitignore
git remote add origin git@github.com:you/claude-config-private.gitgit push -u origin mainSyncing between machines
# Source machine (after modification)cd ~/claude-config-backupgit add agents/ commands/ hooks/ skills/git commit -m "Update hooks: add auto-format"git push
# Target machinecd ~/claude-config-backupgit pull# Symlinks propagate automatically to ~/.claude/settings.local.json for machine-specific overrides
Each machine can have its own preferences without touching the shared configuration. This file takes precedence over settings.json and is never committed.
{ "permissions": { "allow": ["Bash(brew *)", "Bash(docker *)"] }, "env": { "ANTHROPIC_BASE_URL": "http://localhost:8080" }}Alternative: cloud sync via symlink
# Move ~/.claude to Dropbox/iCloudmv ~/.claude ~/Dropbox/claude-configln -s ~/Dropbox/claude-config ~/.claude# Automatic sync between machinesAdvantage: zero maintenance effort. Drawback: no version history, risk of sync conflicts if both machines are active simultaneously.
Automatic backup with cron
# Daily backup at 2am0 2 * * * tar -czf ~/claude-backups/config-$(date +%F).tar.gz \ ~/.claude/agents ~/.claude/commands \ ~/.claude/hooks ~/.claude/settings.jsonEnter your email to read the full card and get the complete PDF bundle.
All content is free and open-source. We just ask for your email.