TL;DR
Use the Strict setup if you want to avoid machine-specific conflicts and leaks. Add a simple .gitattributes for clean diffs. Keep your repo private unless you intentionally want to share it.
Recommended .gitignore
A) Minimal (Keep plugin settings, drop noise)
Preserves most of .obsidian/ directory but excludes cache and local workspace files.
# OS and editor clutter
.DS_Store
._*
Thumbs.db
ehthumbs.db
Icon?
.Spotlight-V100
.Trashes
*.swp
*.swo
*.tmp
# Obsidian
.trash/
.obsidian/cache/
.obsidian/workspace*
.obsidian/updates.json
# Common plugin caches
.obsidian/plugins/*/cache/
.obsidian/plugins/*/.cache/
.obsidian/plugins/*/node_modules/
B) Strict (Maximum conflict prevention)
Excludes the entire .obsidian/ directory to avoid any machine-specific configuration conflicts. You’ll need to set up plugins and settings on each device.
# OS and editor clutter
.DS_Store
._*
Thumbs.db
ehthumbs.db
Icon?
.Spotlight-V100
.Trashes
*.swp
*.swo
*.tmp
# Obsidian - exclude all configuration
.obsidian/
.trash/
Recommended .gitattributes
Add this to get better diffs and prevent line-ending issues:
# Ensure consistent line endings
* text=auto
*.md text
# Treat binary files properly
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.pdf binary
Quick Safety Checklist
- Keep your repository private - Unless you’re building a public knowledge base, your notes likely contain personal information
- Review before first commit - Use
git statusandgit diffto check what you’re committing - Don’t commit sensitive data - Check for API keys, passwords, or personal information in your notes
- Test on a clone first - Before syncing between devices, test the workflow by cloning your repo to a different location
- Use meaningful commit messages - Future you will appreciate knowing what changed and why
Basic Sync Workflow
# Pull changes from other devices
git pull
# Stage and commit your changes
git add .
git commit -m "Update notes from [device name]"
# Push to GitHub
git push
For automatic syncing, consider using Git plugins like Obsidian Git that can auto-commit and push at regular intervals.