Connect Private Github and Other VCS
private GitHub repo integration via ssh keys
Connect private github to pipeline
To connect a private GitHub repo in Azure DevOps, you have 3 reliable methods, depending on what you want:
✅ Method 1: Connect Private GitHub Repo to Azure DevOps Pipeline (Recommended)
This is the standard and easiest method.
Step 1 — Go to Azure DevOps → Pipelines → Create Pipeline
Click New Pipeline
Choose GitHub

Azure DevOps will ask you to authorize GitHub Click Authorize AzurePipelines

GitHub will open → give access to selected repos (Choose the private repo)

After this, Azure DevOps can read your private repo.


Step 2 — Select your private repo
Azure DevOps will list your GitHub repos.
Select your private repo → choose your YAML → pipeline is ready.
☑️ Works for:
✔ Private GitHub repos ✔ Public repos ✔ Organization repos
✅ Method 2: Use GitHub Service Connection (Most secure for enterprise)
Step 1 — Create a GitHub Connection
Go to Project Settings
Click Service Connections
Click New service connection
Choose GitHub
Select:
OAuth (easy), or
Personal Access Token (PAT) (enterprise mode)
Step 2 — Scope your PAT (if using PAT)
On GitHub → Settings → Developer Settings → PAT
Create token with:
repo
workflow
write:packages (if needed)Step 3 — Use in Azure Pipelines YAML
Example:
resources:
repositories:
- repository: mygithubrepo
type: github
endpoint: MyGitHubConnection
name: username/repo-name✅ Method 3: Clone Private GitHub Repo Using SSH inside Azure Pipeline
(Useful if HTTPS blocked / enterprise)
Step 1 — Generate SSH Key
ssh-keygen -t ed25519 -C "azurepipeline"Step 2 — Add public key to GitHub
GitHub → Settings → SSH and GPG keys → New SSH key
Step 3 — Add private key to Azure DevOps
Azure DevOps → Project Settings → Pipelines → Library → Secure Files Upload id_ed25519
Step 4 — Use in pipeline
steps:
- task: InstallSSHKey@0
inputs:
sshKeySecureFile: 'id_ed25519'
knownHostsEntry: |
github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA...
- script: |
git clone [email protected]:USERNAME/REPO.gitThis allows pipeline to clone your private GitHub repo securely via SSH.
🎯 Which method should you use?
CI/CD from private GitHub repo
Method 1
Enterprise, multiple pipelines, secured access
Method 2
SSH only, no HTTPS
Method 3
Want Azure DevOps to mirror GitHub code
Method 3 or GitHub App
🔥 If you tell me your scenario, I will give exact steps:
Example:
Are you trying to run Azure pipeline on a GitHub repo?
Or trying to pull GitHub code from inside Azure pipeline?
Or trying to mirror repo from GitHub into Azure DevOps?
Just reply with your need.

clone if pblic and ssh keys if private
generate keys add public keys in deploy keys / or in acount setting ssh keys section for all repo
add private key https://learn.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops

Copy the contents of the public key (for example, id_rsa.pub) that you generated into the Public Key Data field.
give key name meaningful
Test the connection by running the following command:
PowerShell
git clone [email protected]:v3/fabrikam-fiber/FabrikamFiber/FabrikamFiber
This documentation = SSH access for Azure DevOps Repos (Azure Repos Git)
The commands like:
👉 These are ONLY for Azure DevOps Repos, which are stored inside Azure DevOps itself.
Add Private Key to Azure DevOps Library
Go to Project Settings
Select Pipelines → Library → Secure files
Upload id_ed25519 (private key)
⚠ Never upload the .pub file.
under project setting > repos > reposotory - add repo
and we can switch repo from repos

ecr integration via authenticatig azure ad login while adding acr
agent integration by adding in agent pool
Last updated