Logo Iba Cloud
Go to top

How to create a complete copy of an external repository and save in IBA Cloud Сode

1 min read

Easy repository copying

This is a guide to creating a complete copy of an external repository (including all its branches) and saving it to our IBA Cloud Code. It is useful when the source repository is on another system, such as GitHub (otherwise, you can just fork it).

Use the commands:

Before migrating, make sure there are no open Pull Requests in the source repository, or close them.

1. Clone the repository

1.1 In case there are open Pull Requests in the source repository that cannot be closed, use the following command

$ git clone --bare https://github.com/<remote_user>/<repo_name>.git


1.2 If there are no open Pull Requests, use this command

$ git clone --mirror https://github.com/<remote_user>/<repo_name>.git


2. Go to the created directory

$ cd <repo_name>-migrate

3. Add a new repository address

$ git remote add new-origin git@code.xby.scdc.io:<your_user_name>/<repo_name>.git

4. Load the repository at the new address

$ git push new-origin --mirror

5. After the data is loaded at the new address, you can exit the current directory and clone the repository from the new source for further work

$ cd ..

$ git clone git@code.xby.scdc.io:<your_user_name>/<repo_name>.git

6. [Optional] The <repo_name>-migrate directory can be removed as it was only needed for data migration


If the code is on another GitLab, then it will not be possible to fork into IBA Cloud Code.

Useful Links

Cloning via --bare.

Cloning via --mirror.

The difference between --bare and --mirror is that with mirror, more complete cloning occurs (notes, full history, remote branches, etc.). And with bare, the main thing is cloned (all code, branches, and tags).

GitLab also has built-in import functionality.