我正在尝试clone --mirror
一个云源存储库并将其推送到 gitlab 作为备份机制。当我第一次尝试这样做时,没有错误。但是,当我在将一些更改推送到云源存储库后再次对其进行测试时,我收到了以下错误。
! [remote rejected] origin/feature -> origin/feature (deny updating a hidden ref)
! [remote rejected] origin/master -> origin/master (deny updating a hidden ref)
! [remote rejected] origin/test -> origin/test (deny updating a hidden ref) error: failed to push some refs to 'https://gitlab.com/xxxx.git'
下面是每次需要进行备份时触发的构建配置文件。
steps:
- name: gcr.io/cloud-builders/git
args:
- clone
- '--mirror'
- 'https://source.developers.google.com/cloud-source-repo'
- name: gcr.io/cloud-builders/git
args:
- fetch
- '--unshallow'
- name: gcr.io/cloud-builders/git
args:
- '-c'
- ls
- cd backup-to-gitlab.git
entrypoint: bash
- name: gcr.io/cloud-builders/git
args:
- remote
- set-url
- '--push'
- origin
- >-
https://xxx:password@gitlab.com/xxxx.git
- name: gcr.io/cloud-builders/git
args:
- push
- '--mirror'
- name: gcr.io/cloud-builders/git
args:
- '-c'
- ''
- cd ..
- rm
- '-rf'
- backup-to-gitlab.git
entrypoint: bash