Repo Migration from ADO to Github - ashwanisinghel/aksMigration GitHub Wiki
This guide helps you migrate an Azure DevOps Git repo directly to GitHub without cloning it locally, using token-based auth and a one-liner command.
- Go to: https://dev.azure.com//_usersSettings/tokens
- Scope:
Code (Read)
- Go to: https://github.com/settings/tokens
- Scope:
repo
,workflow
Replace the placeholders with real values.
# Format:
# ADO (source):
https://<ADO_USERNAME>:<ADO_PAT>@dev.azure.com/<ADO_ORG>/<ADO_PROJECT>/_git/<ADO_REPO>
# GitHub (destination):
https://<GITHUB_USERNAME>:<GITHUB_PAT>@github.com/<GITHUB_USERNAME>/<GITHUB_REPO>.git
# Create a temporary mirror clone (bare repository)
git clone --mirror https://<ADO_USERNAME>:<ADO_PAT>@dev.azure.com/<ADO_ORG>/<ADO_PROJECT>/_git/<ADO_REPO>
cd <ADO_REPO>.git
# Push everything to GitHub
git push --mirror https://<GITHUB_USERNAME>:<GITHUB_PAT>@github.com/<GITHUB_USERNAME>/<GITHUB_REPO>.git
cd ..
rm -rf <ADO_REPO>.git
- This mirrors all branches, tags, commit history, etc.
- The repo must already exist on GitHub (create it manually or via CLI).
- If you want to make it scriptable, replace tokens with environment variables.
export ADO_USER="myuser"
export ADO_PAT="********"
export GITHUB_USER="myghuser"
export GITHUB_PAT="********"
export ADO_REPO="repo1"
export GITHUB_REPO="repo1"
export ADO_PROJECT="MyProject"
export ADO_ORG="MyOrg"
git clone --mirror https://$ADO_USER:$ADO_PAT@dev.azure.com/$ADO_ORG/$ADO_PROJECT/_git/$ADO_REPO
cd $ADO_REPO.git
git push --mirror https://$GITHUB_USER:$GITHUB_PAT@github.com/$GITHUB_USER/$GITHUB_REPO.git
cd ..
rm -rf $ADO_REPO.git