将 Github 同步到 Azure Devops Repo

Sync Github to Azure Devops Repo

我在 Github 中有一个 git 回购协议,像往常一样有几个 b运行ches 和 master

我想 运行 每 X 间隔一个管道,基本上将 Github repo 中的所有内容镜像到 Azure Repo,丢弃在 Azure 端所做的任何不同。所以基本上是一面镜子。

到目前为止我做了什么:

name: Keep clone up to date
variables:
  REMOTE_ADDR: 'https://github.com/some-user/some-repo.git'
stages:
  - stage: running_git_commands
    displayName: running_git_commands
    jobs:
      - job: initiate
        displayName: initiate
        continueOnError: false
        steps:
        - checkout: self
          clean: true
          persistCredentials: true
          displayName: run_commands
        - bash: | 
            git checkout master
            git remote add repoGithub $(REMOTE_ADDR)
            git fetch repoGithub master
            git reset --hard repoGithub/master
            git pull --rebase repoGithub master

管道 运行 正常,没有故障。 bash的内容如下:

Starting: Bash
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.189.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /some/vsts/path/to.sh
Switched to a new branch 'master'
Branch 'master' set up to track remote branch 'master' from 'origin'.
From https://github.com/some-user/some-repo
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> repoGithub/master
HEAD is now at someCommitHex someSemverString
From https://github.com/some-user/some-repo
 * branch            master     -> FETCH_HEAD
Already up to date.
Finishing: Bash

无论我做什么,我都无法覆盖更改并将 Azure 存储库与 Github 的精确副本同步。我知道 p运行ing 和创建镜像,但是我当然对为什么上述方法不起作用很感兴趣。

我错过了什么?

您的管道需要将更新的存储库推送到 Azure DevOps git 存储库。

git push -f origin