6

I am trying to duplicate an existing repository. I have a project called Test and I would like to create a duplicate of it called Test1. The reason I don't just want to create another branch of it is because the new repo will have a different UI (replacing Angular with React) and don't want any branching dependencies to the old one.

I am an admin on Gitlab but I only see options to Move and Delete repo but no Copy repo. This is inside a corporate's infrastructure so I don't have access to the command line git tools but I am admin in Gitlab.

enter image description here

4
  • I'm not following your comment about being unable to use the git command line. If you can't make a clone, how do developers actually develop? FWIW I have used git in numerous corporate environments, and in every one of them we cloned the repo normally and could then use the command line tools (or an IDE, or whatever)... because that's kind of the point with git Commented Mar 12, 2019 at 17:55
  • We have git installed and are able to run all commands but I think the issue is that accessing artifacts through the command line (and some websites through the browser) is blocked. Commented Mar 12, 2019 at 18:50
  • Ok... I'm not sure if the issue is just terminology, but this still isn't making sense to me. So to simplify: A dev comes onto the team. They need a copy of the code so they can do dev things to it. They do... what? Commented Mar 12, 2019 at 20:02
  • Access everything through SourceTree which is configured with all the proxy settings I guess. When I do a git clone on the project through cmd, I get some fatal errors. Basically I don't have admin access to my Windows box. Commented Mar 12, 2019 at 20:05

1 Answer 1

8

Clone-based approach

You could clone the repository and push it to a different remote (which you would create manually on the server):

  1. Create a new repository (here https://gitlab.example.com/user/Test1)
  2. Clone your original repository
git clone --mirror https://gitlab.example.com/user/Test
  1. Change the remote on the cloned repository:
cd Test # optionally rename the directory if you want to keep it
git remote remove origin
git remote add origin [email protected]:user/Test1
  1. Push to your new remote
git push --all origin
git push --tags origin

Web-based approach

  1. Create a temporary namespace (a group for example) or use an existing one
  2. Fork your project to the temporary namespace
  3. Remove the fork relationship
  4. Rename the forked project to Test1 (make sure you change both the path and the name)
  5. Transfer project back to original owner
  6. Remove temporary namespace (if applicable)
Sign up to request clarification or add additional context in comments.

8 Comments

Like I mentioned above, I am inside a corporate infrastructure and I don't have access to the git command line because of some proxy settings. I need to try and do it from Gitlab. I know it's easy to do using the command line.
The command line commands would have to be run on your own machine (you could also do it in a git graphical frontend)
@p0tta I updated my answer with a purely web-based approached (does not even require administration rights)
While I don't understand OP's objection to using a clone (see my comment on the question), I would disagree with the clone-based method documented here. Using --mirror is much more straightforward and makes fewer assumptions about the repo.
What if I fork it and don't sync it with the existing repository?
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.