Skip to main content
Code Guide
T10 Intermediate Technical

Multi-Machine Config & Backup

Syncing your Claude Code configuration across multiple machines

PDF
← All cards

What stays local vs what is shareable

Local onlyShareable
settings.local.jsonagents/, commands/
API keys, tokenshooks/, rules/, skills/
Session historysettings.template.json
.env with secretsCLAUDE.md (team conventions)

Golden rule: never commit API keys or credentials. Use template files with ${VAR_NAME} placeholders for sensitive values.

Approach inspired by Martin Ratinaud (504 tested sessions) and brianlovin/claude-config.

Terminal window
# 1. Create a private repo for global config
mkdir ~/claude-config-backup && cd ~/claude-config-backup
git init
# 2. Create symlinks (changes are automatic)
ln -s ~/.claude/agents ./agents
ln -s ~/.claude/commands ./commands
ln -s ~/.claude/hooks ./hooks
ln -s ~/.claude/skills ./skills
# 3. Template without secrets
cp ~/.claude/settings.json ./settings.template.json
# Replace values with ${ANTHROPIC_API_KEY} etc.
# 4. Strict .gitignore
echo "settings.json\nmcp.json\nprojects/" > .gitignore
git remote add origin git@github.com:you/claude-config-private.git
git push -u origin main

Syncing between machines

Terminal window
# Source machine (after modification)
cd ~/claude-config-backup
git add agents/ commands/ hooks/ skills/
git commit -m "Update hooks: add auto-format"
git push
# Target machine
cd ~/claude-config-backup
git 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"
}
}
Terminal window
# Move ~/.claude to Dropbox/iCloud
mv ~/.claude ~/Dropbox/claude-config
ln -s ~/Dropbox/claude-config ~/.claude
# Automatic sync between machines

Advantage: zero maintenance effort. Drawback: no version history, risk of sync conflicts if both machines are active simultaneously.

Automatic backup with cron

Terminal window
# Daily backup at 2am
0 2 * * * tar -czf ~/claude-backups/config-$(date +%F).tar.gz \
~/.claude/agents ~/.claude/commands \
~/.claude/hooks ~/.claude/settings.json

Enter 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.

PDF: