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.
To maintain a mirror of a repository without forking it, you can run a special clone command, then mirror-push to the new repository.
In gitlab there is functionality out of the box:
Settings
-> General
of existing projectAdvanced
contains Export
button. Click it and then on the top of this page you can see info message Project export started. A download link will be sent by email.
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.
Downloads
folderProject - Your projects
pageNew project
Blank project
tabImport project
tabGitlab export
Choose file
and select previously downloaded file *.tar.gz
Import project
Import in progress
label.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.
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 2.
cd ..
rm -rf _old-repository_
reference: https://help.github.com/articles/duplicating-a-repository/
Another easiest way is ...
You can import your existing repositories by providing the Git URL:
https://docs.gitlab.com/ee/user/project/import/repo_by_url.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With