I am trying to clone --mirror
a cloud source repository and push it to gitlab as a backup mechanism. When I first tried to do it, there was no error. However, when I tested it again after pushing some changes to the cloud source repo, I am getting the below error.
! [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'
Below is the build config file that is triggered every time a backup needs to be taken.
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