Back to Feed
r/ClaudeAI
by uppinote
New
Keep your Claude config files private while working on public repos
1 points
1 comments
100% upvoted
View on Reddit
Content
If you're working on a public repo but want to keep `.claude`, `CLAUDE.md`, and other AI configs private and version-controlled, here's a simple setup I've been using.
## The Problem
Adding AI config files to `.gitignore` keeps them out of public repos, but you lose:
- Version control / history
- Backup across machines
- Easy recovery if something breaks
## Solution: Private Repo + Symlinks
**1. Create a private repo for your configs**
```bash
gh repo create private-project-docs --private
2. Clone it as a hidden folder with orphan branches per project
git clone -b project-name git@github.com:you/private-project-docs.git .private
**3. Move existing configs and create symlinks**
```bash
# Move existing files to .private
mv docs .private/
mv .claude .private/
mv CLAUDE.md .private/
# Create symlinks
ln -s .private/docs docs
ln -s .private/.claude .claude
ln -s .private/CLAUDE.md CLAUDE.md
```
4. Add to your public repo's .gitignore
.private/
docs
.claude
CLAUDE.md
How It Works
- Work normally in your project - Claude Code follows symlinks fine
- Push from .private/ to backup your configs with full history
- Multiple projects = one branch each in the same private repo
- Others who clone your public repo won't get broken symlinks (they're gitignored)
VSCode Note
If VSCode doesn't recognize the nested git repo, add to settings:
"git.scanRepositories": [".private"]
---
Anyone else managing private AI configs in public repos? Curious how others handle this.
Comments
No comments fetched yet
Comments are fetched when you run cortex fetch with comment fetching enabled