将所有 github 仓库备份到 bitbucket

时间:2021-07-20 12:46:01

标签: github gitlab bitbucket github-api bitbucket-api

类似问题:Auto mirror all GitHub repository to gitlab

GitLab 支持 pull mirror,这使得从 github 备份到 gitlab 变得更加容易。

bitbucket 也支持镜像吗? 如果没有,“使用服务器推送更改”是从 github 备份所有 repo 的唯一方法吗?

1 个答案:

答案 0 :(得分:0)

<块引用>

bitbucket 是否也支持镜像

我所知道的没有 pull mirror,只有 smart mirror(本地镜像远程仓库)

<块引用>

如果不是,“使用服务器推送更改”是从 github 备份所有 repo 的唯一方法吗?

是的,除非它是 GitHub 服务器,而不是您自己的。
您可以使用 actions/mirroring-repository

<块引用>

用于将存储库镜像到 GitHub、GitLab、BitBucket、AWS CodeCommit 等上的另一个存储库的 GitHub 操作。

这将复制所有提交、分支和标签。

示例,来自 pixta-dev/repository-mirroring-action issue 3

# Deploy to BitBucket repos

name: Deploy to BitBucket Wordpress Repositories


# You may pin to the exact commit or the version.
# uses: pixta-dev/repository-mirroring-action@02f1627ade9e6b3b69e6a6d4fe8bc997474f48d1
# uses: pixta-dev/repository-mirroring-action@v1
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  deploy_to_test_repo:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - uses: actions/checkout@v1
      - uses: pixta-dev/repository-mirroring-action@v1
        with:
          target_repo_url:
            git@bitbucket.org:username/reponame.git
          ssh_private_key:
            ${{ secrets.BITBUCKET_SSH_PRIVATE_KEY }}

除非您需要use an access key