Gitlab: copy project to other git lab repository

回眸只為那壹抹淺笑 提交于 2019-11-28 04:45:04

问题


I want to copy a gitlab project to other repository which be completely independent from original project.

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

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

How can I do this?


回答1:


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.




回答2:


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 parts, configurations, etc. listed above to your other project. The result would still be 2 separate projects (ex. 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.




回答3:


Another option, when you might not have access to the GitLab export project button, is to import directly from an url.



来源:https://stackoverflow.com/questions/53155915/gitlab-copy-project-to-other-git-lab-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!