What is the recommended way of migrating a repository from one path to another on same GitLab instance


I’m using Gitlab where I have a repository called reports under the path or group as https://example.gitlab.com/my_company/source_group which I want to move to another group on the same GitLab Instance as https://example.gitlab.com/my_company/target_group

The current repo URL is https://example.gitlab.com/my_company/source/reports.

Now, there are two methods that I can see that can help me to migrate this repository when I go to the Project Repository Settings → General-> Advanced as Change Path and Export Project.

I do want to keep all the things related to my current repository, reports i.e. code, commit history, CI variables, token (if possible), tags, etc. I feel changing the path is easier in my case as I just want to move from one group to another since it is the same Gitlab instance. May I know three things:-

  1. If I change the path, will I be able to revert to the source group later?
  2. Is changing the path the right way to do in my case?
  3. What are the drawbacks of using an exporting project and then importing as a new repository in a new group?

Changing the path is most likely the best way forward, and the most simple. In answer to your questions:

  1. Why would you want to revert it to the source path later? Either you want to move it to the target path or you don’t? I don’t see a reason why it cannot be moved back though.
  2. As above, yes, the correct way, easiest, and quickest.
  3. Drawbacks of exporting, maybe you don’t completely get everything that you want. Never tried it, so guessing that some things could be missing - tokens, commit history, variables. You can always try it and see what happens. It will be time-consuming though exporting and importing - so another reason why not to use that method.
1 Like