Sync Github to Azure Devops Repo



我在Github上有一个git仓库,像往常一样有几个分支和master

我想运行一个管道每X间隔基本上镜像从Github repo到Azure repo的一切,丢弃任何不同的已经在Azure方面做了。所以基本上就是一面镜子。

到目前为止我做了什么:

  • 创建新项目
  • 使用import选项
  • 从Github导入repo
  • 创建azure.yaml,内容如下:
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://learn.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 repo与Github的精确副本同步。我知道修剪和创建镜像,但是我当然对为什么上面的方法不起作用感兴趣。

我错过了什么?

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

git push -f origin

相关内容

  • 没有找到相关文章

最新更新