我在 Github 有一個 git repo,和master往常一樣有幾個分支。
我想每隔 X 間隔運行一個管道,以將 Github 存盤庫中的所有內容基本上鏡像到 Azure 存盤庫,丟棄在 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://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 的精確副本同步。我知道修剪和創建鏡像,但是我當然對上述方法不起作用的原因感興趣。
我錯過了什么?
uj5u.com熱心網友回復:
你的管道需要將更新的存盤庫推送到 Azure DevOps git 存盤庫。
git push -f origin
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/341643.html
