githubgitlabbitbucketgithub-apibitbucket-api

Backup all github repo to bitbucket


similar question: Auto mirror all GitHub repository to gitlab

GitLab supports a pull mirror, which makes backup from github to gitlab much easier.

does bitbucket support mirror also? if not, is "using a server to push changes" the only way to backup all repo from github?


Solution

  • does bitbucket support mirror also

    No pull mirror that I know of, only smart mirror (to mirror remote repositories locally)

    Smart mirror was deprecated April 21, 2021.

    if not, is "using a server to push changes" the only way to backup all repo from github?

    Yes, except it would be the GitHub servers, not your own.
    You could use actions/mirroring-repository:

    A GitHub Action for mirroring a repository to another repository on GitHub, GitLab, BitBucket, AWS CodeCommit, etc.

    This will copy all commits, branches and tags.

    Example, from 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 }}
    

    Except you would need to use an access key.