Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to synchronize Github and Azure DevOps repository?

I have two repository, first on Azure DevOps, second on GitHub. I'd like to update GitHub repository to have the same code on both repositories. How can I do it without manually copying source code?

like image 647
riko1520 Avatar asked Jun 09 '26 01:06

riko1520


1 Answers

You can include a Pipeline step that runs git, to copy the repo over. Something like this:

steps:
- bash: |
    git push --prune https://$(GITHUB_PAT)@github.com/$REPO_NAME \
        +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
  displayName: 'Copy to Github'
  condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')

(Copied from https://github.com/Azure/AzureStor/blob/master/azure-pipelines.yml, slightly modified)

like image 99
Hong Ooi Avatar answered Jun 11 '26 23:06

Hong Ooi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!