I want to copy a gitlab project to other repository which be completely independent from original project.
For this reason I tried forking original
I would clone the original project in a sandbox on your local machine, create the new project where you want it, set your new gitlab location as the remote and push there.
Assuming old_url and new_url are your old and new URLs:
git clone <old_url>
cd <repo_dir_name>
git remote add new_remote <new_url>
git push --all new_remote
Assuming your new repo was empty when you did this, it will now contain all the branches and tags that exist in the original repo, without any connections to it.
Another option is to use Gitlab's export/import feature.
The difference with the other answer is that it also copies the following:
- Project and wiki repositories
- Project uploads
- Project configuration, including services
- Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities
- LFS objects
So it depends on your use-case if you just want to copy the codes or if you also want to migrate the other project management parts and configurations as listed above. The result would still be 2 separate projects (i.e. It will not appear as a fork).
To export, go to your project's Settings > General page:
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.
Another option, when you might not have access to the GitLab export project button, is to import directly from an url.