Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy a Gitlab project to another Gitlab repository?

I want to copy a GitLab project to another repository which should be completely independent from the original project.

For this reason, I tried forking the original project into another project. But inside the original project, the maintainer still can see a list of forks and knows where the other forks are maintained.

I want to have a complete copy without any link to the main project so it cannot be managed by the original project maintainer.

How can I do this?

like image 285
VSB Avatar asked Nov 05 '18 14:11

VSB


1 Answers

Another option is to use Gitlab's export/import feature.

Existing projects running on any GitLab instance or GitLab.com can be exported with all their related data and be moved into a new GitLab instance.

The difference with the other answer is that it also copies the following:

Exported contents

The following items will be exported:

  • Project and wiki repositories
  • Project uploads
  • Project configuration, excluding integrations
  • Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities
  • Design Management files and data
  • LFS objects
  • Issue boards
  • Pipelines history
  • Push Rules

So it depends on your use-case if you want to copy just the codes or if you also want to also migrate the other non-code items as listed above. The result would still be 2 separate projects (i.e. It will not appear as a fork).

Take note that:

The GitLab import/export button is displayed if the project import option is enabled.

To export, go to your project's Settings > General page:

export

Then wait for the email with the downloadable tar.gz. file.
(On my version of Gitlab, if you click the button twice, you can download directly from the browser.)

Then to import, on Gitlab, select the New button > New Project from the top bar.
Then, select Import Project > Gitlab export.

Import

The UI screenshots above may change on future Gitlab versions. Again, make sure to refer to your Gitlab instance's docs pages, or check out the public one from Gitlab EE: Project import/export .

like image 171
Gino Mempin Avatar answered Oct 18 '22 14:10

Gino Mempin