问题
I've an existing repository on Gitlab / Github. I want a duplicate of that under the same group with a different repo name.
Note: Thought the answers might be similar to another question, I was not able to find the said another question by googling, I'm guessing other users might be unable to do so either.
回答1:
Duplicating a repository
To duplicate a repository without forking it, you can run a special clone command, then mirror-push to the new repository.
Before you can duplicate a repository and push to your new copy, or mirror, of the repository, you must create the new repository on GitHub/Gitlab. In these examples, exampleuser/new-repository
is the mirrors.
Mirroring a repository
1. Open (windows) Git Bash
You can use (mac)Terminal / (linux)Terminal as well
2. Create a bare clone of the repository.
git clone --bare https://github.com/_exampleuser_/_old-repository_.git
3. Mirror-push to the new repository.
cd _old-repository_.git
git push --mirror https://github.com/_exampleuser_/_new-repository_.git
4. Remove the temporary local repository you created in step 1.
reference: https://help.github.com/articles/duplicating-a-repository/
回答2:
In gitlab there is functionality out of the box:
- Go to
Settings
->General
of existing project - Last expanded panel
Advanced
containsExport
button. Click it and then on the top of this page you can see info messageProject export started. A download link will be sent by email.
- Check email. There is following message:
Project NAME_OF_YOUR_EXISTING_PROJECT was exported successfully.
The project export can be downloaded from: SOME_LINK
The download link will expire in 24 hours.
- Click SOME_LINK and then check the
Downloads
folder - Go to
Project - Your projects
page - Click the button
New project
- Set name of your new project on
Blank project
tab - Then go to
Import project
tab - Click the button
Gitlab export
- Click
Choose file
and select previously downloaded file*.tar.gz
- Click the button
Import project
- Then you will see
Import in progress
label. - DEAL
来源:https://stackoverflow.com/questions/45824867/how-to-duplicate-a-git-repository-on-gitlab-github-without-forking