Skip to content

Instantly share code, notes, and snippets.

@BhangeeF16
Last active March 14, 2023 07:34
Show Gist options
  • Save BhangeeF16/5ee319c8b82b66ee7a8f6f66dc00b550 to your computer and use it in GitHub Desktop.
Save BhangeeF16/5ee319c8b82b66ee7a8f6f66dc00b550 to your computer and use it in GitHub Desktop.
This pipeline performs the following steps: Uses Python version 3.x to run subsequent tasks. Uses Azure CLI to clone the Azure DevOps repository and all its branches with change history recursively to the current directory. Adds the GitHub repository as a remote for the cloned repository. Pushes the cloned repository with all its branches and ch…
trigger:
- main
variables:
azureSubscription: "<Your Azure subscription name>"
azureDevOpsOrg: "<Your Azure DevOps organization name>"
azureDevOpsProject: "<Your Azure DevOps project name>"
azureDevOpsRepo: "<Your Azure DevOps repository name>"
gitHubRepo: "<Your GitHub repository URL>"
gitHubUsername: "<Your GitHub username>"
gitHubToken: "<Your GitHub personal access token>"
pool:
vmImage: "ubuntu-latest"
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "3.x"
addToPath: true
- task: AzureCLI@2
inputs:
azureSubscription: $(azureSubscription)
scriptLocation: "inlineScript"
inlineScript: |
az repos clone --output none --recursive --all --source https://dev.azure.com/$(azureDevOpsOrg)/$(azureDevOpsProject)/_git/$(azureDevOpsRepo) .
- run: git remote add origin $(gitHubRepo)
- run: git push --mirror https://$(gitHubUsername):$(gitHubToken)@github.com/$(gitHubRepo).git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment