[英]Error mirroring a git repo from Bitbucket to Github
我正在按照本指南设置从我的私有 Bitbucket 存储库到私有 Github 存储库的镜像。
https://medium.com/@dmitryshaposhnik/sync-bitbucket-repo-to-github-669458ea9a5e
基本上,该指南涉及设置 bitbucket 管道,如下所示:
clone:
depth: full
pipelines:
default:
- step:
name: 'Mirror to Github repo....'
script:
- git push --mirror git@github.com:my-repo/repo.git
我让它(有点)工作,但由于以下原因管道失败:
: [remote rejected] master (refusing to delete the current branch: refs/heads/master)
所以看起来git push --mirror
命令首先删除所有分支,对吗?
我明白为什么主删除不起作用(除非它是 github 管理员,否则不允许)并且我不想更改主等。
我只是想将 bitbucket 存储库上的所有 git 事件传送到 github 存储库。
任何人都知道如何做到这一点而不会遇到这个问题?
另外,我知道我可以通过在本地向 repo 添加另一个删除然后从那里推送来做到这一点,但我正在寻找一种可以在服务器端处理的解决方案,以简化我团队的 rest 不必开始手动添加第二个遥控器等。
您需要执行以下操作:
default:
- step:
name: 'mirror repo'
script:
- git clone --mirror "${BITBUCKET_GIT_SSH_ORIGIN}" ./mirrored;
- cd ./mirrored;
- git fetch -p --tags origin;
- git push --mirror "git@github.com:you/target-repo.git"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.