Multi-Machine Config & Backup
Syncing your Claude Code configuration across multiple machines
PDF editions Β· Guide v3.44.1 Β· Updated
What stays local vs what is shareable
| Local only | Shareable |
|---|---|
settings.local.json | agents/, skills/ |
| API keys, tokens | hooks/, rules/ |
| 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.
Version reviewed configuration files
Keep actual files in a configuration repository. A symlink from the repository to ~/.claude stores only the link target in Git, not the referenced contents.
# Create a new private configuration repositorymkdir ~/claude-config-backupcd ~/claude-config-backupgit init# Copy only directories that exist and have been reviewedcp -R ~/.claude/agents ./agentscp -R ~/.claude/skills ./skillscp -R ~/.claude/hooks ./hooks# Inspect copies for secrets and machine-specific paths before staginggit add agents skills hooksgit diff --cached# Commit and push only after reviewing the staged contentCreate a sanitized settings template separately. On another machine, clone the repository and compare files with the current configuration before copying them into place. Back up existing files and review hooks before enabling them.
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" }}Cloud backup scope
Back up reviewed configuration templates rather than the entire ~/.claude directory, which also contains transcripts and potentially credentials. Choose access and retention settings for the actual data.
Automatic backup with cron
Create the backup directory first and protect it appropriately. This cron entry archives the reviewed repository; cron requires the percent sign in date to be escaped.
0 2 * * * tar -czf "$HOME/claude-backups/config-$(date +\%F).tar.gz" -C "$HOME" claude-config-backupEnter 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.