While building my website π, I ran into an architecture constraint π§ .
My entire repository needed to stay private π because it contains drafts and internal structure. However, one folder (/website) powers the basic version of my blog and had to be public π.
I didnβt want:
Duplicate repositories π
Manual copying β
Risk of exposing private files π«
Inconsistent content between repos π
βοΈ The Solution
I implemented a GitHub Actions workflow π€ inside the private repository that:
Triggers only on website/** changes π
Uses a Personal Access Token (PAT) stored as a secret π
Clones the public repository π
Syncs using rsync --delete πͺ
Commits and pushes automatically π
The --delete flag ensures removed files are also mirrored, keeping both repositories perfectly in sync π.
ποΈ Final Setup
Private repo β Full development workspace π§βπ»
Public repo β Clean blog content layer π¦
Publishing β Fully automated pipeline β‘
This approach keeps a single source of truth π while maintaining proper separation of concerns π§©.
If you're facing similar repo separation challenges, this pattern works cleanly and reliably.
Full step-by-step guide π
https://vineelvanjari.com/blog/sync-private-repo-subfolder-to-public-repo-using-github-actions
Top comments (0)