Delete a project in Gerrit
Asked Answered
L

6

34

I can create a project in Gerrit through:

ssh –p 29418 [ip-address] gerrit create-project --name [project-name]

But, how can I delete any project? I haven't see related commands or buttons on web page.

Lagniappe answered 4/1, 2012 at 8:2 Comment(0)
M
24

Notice: Since this question was origionally asked, I've released the delete project plugin, and handed it off to the more active Gerrit devs. If you are using Gerrit >= 2.7, I'd recommend this route. If not, read on.

There isn't a method to delete projects from Gerrit currently. It must be done by hand. This is the most-requested feature of Gerrit.

There are two steps to delete a project by hand:

  1. Delete the repository from the server's file system

  2. Delete any references of the repository from the database. The tables to purge depend on the version of Gerrit you are running - the projects table was removed in 2.2.0 for example.

If you're deleting a project on an active Gerrit server, you should consider shuting down Gerrit before.

Mireille answered 4/1, 2012 at 15:46 Comment(1)
Is there a pre-buildt version of this plugin somewhere? If not, how do I build and install it?Messina
B
15

Our workflow for deleting projects from gerrit is to first delete the .git directory. After that do

ssh -p 29418 gerrit.server.local gerrit flush-caches --cache projects

(or --all if you are doing some house keeping anyway ;-) )

Bucella answered 6/2, 2014 at 10:18 Comment(2)
With gerrit version 2.9.1, you have to use this command: ssh -p 29418 gerrit.server.local gerrit flush-caches - as the last argument is not recognized.Messina
After this the server will not create a new repository with the same name.Marcmarcano
L
13

See the delete-project plugin

ssh -p 29418 gerrit.example.com delete-project delete --yes-really-delete my-project

We were able to install it in a 2.7 instance

The above cited gerrit issue also includes instructions that add a UI button to the project page.

Longevous answered 18/10, 2013 at 19:56 Comment(2)
According to this comment the delete-project plugin now comes with a button on the project screen.Zugzwang
This worked for me. I had to use delete-project instead of deleteproject. Please update the answer with the typo fixed. I used it on a v2.16.7 installation.Thrombo
C
3

Using Gerrit 2.15.6, I was able to click on a very handy 'Delete Project' button in the Gerrit UI:

Delete Project in Gerrit

at the bottom of the project admin page.

Congreve answered 7/1, 2019 at 22:22 Comment(0)
P
2

Deleting the raw .git file from your repository and either flushing the changes or restarting the gerrit service worked for us.

Note: Make sure you dont have any pending reviews for the repository you are deleting.

Prosthesis answered 7/3, 2014 at 3:47 Comment(2)
Excatly! If you have access to remove local repository ".git" - project will disappeared from the project list on gerrit site.Derek
After this the server will not create a new repository with the same name.Marcmarcano
B
0

Deleting didn't work for me and I have no access to the server files, best solution was to hide the project.

  1. On the project page, find Project Options, then State.
  2. In the State select box, choose Hidden.
  3. Press Save Changes.
Burble answered 28/3, 2019 at 15:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.