Clone a Private Repo Using GitHub Secrets in GitHub Actions

Clone a Private Repo Using GitHub Secrets in GitHub Actions Cloning a private repository inside another GitHub Actions workflow is a common use case — whether you’re reusing shared scripts, configs, or tools. Here’s how to do it securely using GitHub Secrets. 🔐 Step 1: Generate a Personal Access Token (PAT) Go to GitHub > Settings > Developer Settings > Tokens. Click “Generate new token” (classic or fine-grained). Grant the following scopes: repo for private repos read:org if the repo is under an organization Copy the token (you won’t see it again). 🔑 Step 2: Add the Token to Secrets In your destination repo: ...

May 12, 2025 · 2 min · Rohan