Created
July 8, 2023 08:25
-
-
Save UlyssesWu/f5efb22e731407ebaff4a10f6d64b5f0 to your computer and use it in GitHub Desktop.
AzGitSync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mainly generated by GPT-4 | |
trigger: none | |
schedules: | |
- cron: "0 0 * * *" # This will trigger the pipeline every day at midnight | |
displayName: Daily midnight sync | |
branches: | |
include: | |
- main | |
jobs: | |
- job: Sync | |
pool: | |
vmImage: ubuntu-latest | |
steps: | |
- script: | | |
git config --global user.email "you@example.com" | |
git config --global user.name "Your Name" | |
REPOS="user1/repo1 user2/repo2 user3/repo3" # Specify your repositories here | |
for REPO in $REPOS | |
do | |
git clone --mirror https://github.com/${REPO}.git | |
cd $(basename ${REPO}).git | |
git remote add azdo https://dev.azure.com/$(org)/$(proj)/_git/$(basename ${REPO}) | |
# user is a placeholder, don't have to be your address | |
git push https://$(user):$(secret)@dev.azure.com/$(org)/$(proj)/_git/$(basename ${REPO}) --mirror | |
cd .. | |
done | |
displayName: 'Sync repos' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment