Migrating an existing Git repository to Bitbucket is relatively easy and straightforward. However, if not done correctly, the new repository will not contain all the branches and tags from the previous repository. Here are the three simple steps that you need to follow:
- Clone the existing source repository using –mirror
- Create a new destination repository
- Push local repository to the destination repository using –mirror
Preparing an existing repository for transfer
The following steps will create a bare clone of an existing repository without a working directory.
- Clone the repository using the –mirror command:
git clone –mirror [source_repository]
- This will give you a bare repository in a folder called:
googletest.git
Creating a new Bitbucket repository
Next, you need to create a new repository to transfer this repository too. You can use the link below to create a Bitbucket repository if you have an account.
https://bitbucket.org/repo/create
Pushing repository to Bitbucket
The final step is to push the contents of the bare repository to the new Bitbucket repository that you created.
git push –mirror [destination_repository]
Be First to Comment