'How to rename Gitlab repository name using API

I have created several repositories in GitLab.Now I want to rename or remove repository. How can I do this? is there any API available? or is there any git command available for this?



Solution 1:[1]

I guess by repository you mean projects. If you just want remove them from the GUI have a look at this issue. If you have the latest version of GitLab have a look at the second answer also cause it seems there are some changes made recently.

If you want to rename the projects through the API you can have a look at the documentation. Have in mind that to use the API you have to make sure it is enabled and also if it is self-hosted, that you are using the correct path when making the requests

Solution 2:[2]

To rename a repository on GitLab:

  1. Navigate to your project's Settings > General > Advanced settings.
  2. Under "Rename repository", change the "Path" to your liking.
  3. Hit Rename project.

Solution 3:[3]

SEEMINGLY NOT POSSIBLE

Try this: your project --> Settings (gearwheel icon) --> General --> Advanced

There is no "Rename repository" as at 2022-03-26, but there is a "Change path". First change this.

At the top of the "Advanced" page you also have to change the "Project name" and then click "Save changes".

This seems to have changed everything. However, it is not so!

If you then try to git clone from a Terminal using the old name, the old project will indeed be cloned. Equally, if you try to push an initial commit of a new project, this will be rejected. Annoyingly therefore, it appears that Gitlab doesn't implement this properly.

WORKAROUND

Very simple: remove the project COMPLETELY from Gitlab. Then recreate it using your chosen method under a new name.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dstrants
Solution 2 midi
Solution 3 mike rodent