[英]Sync Github to Azure Devops Repo
I have a git repo in Github, with couple of branches and master
as usual.我在 Github 有一个 git repo,像往常一样有几个分支和
master
。
I want to run a pipeline every X interval to basically mirror everything from Github repo into Azure Repo, discarding whatever different has been done on Azure side.我想每隔 X 间隔运行一个管道,以将 Github 存储库中的所有内容基本上镜像到 Azure 存储库,丢弃在 Azure 端所做的任何不同操作。 So basically a mirror.
所以基本上是一面镜子。
What I have done so far:到目前为止我做了什么:
import
optionimport
选项从 Github import
repoazure.yaml
with the following contents: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
The pipeline runs OK without failures.管道运行正常,没有故障。 The contents of the bash are as follows:
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
no matter what I do, I cannot get to overwrite changes and sync the Azure repo with an exact copy of Github one.无论我做什么,我都无法覆盖更改并将 Azure 存储库与 Github 的精确副本同步。 I am aware of pruning and creating a mirror, however I am certainly interested in why the above approach does not work.
我知道修剪和创建镜像,但是我当然对上述方法不起作用的原因感兴趣。
What am I missing?我错过了什么?
你的管道需要将更新的存储库推送到 Azure DevOps git 存储库。
git push -f origin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.