Delete repository from database (SQL and repo folder)

Hi there,

I’m working on upgrade from our gitlab from 8 to a newer versions, so, during each upgrade, I execute a full backup using gitlab-rake gitlab:backup:create, everything works fine until 8.17.8 version.

I have a older repo (already archived), and it contains bigger files and now I get message about corrupt during pack files, like this:
"error: inflate: data stream error (incorrect data check)"

I don’t have interest in fix it, I just want to remove it from gitlab…from data folder and database.

Has anyone ever removed a repository from the database and the data folder?

Can I delete project from projects and related tables ?

Gitlab version: 8.17.8
SO: Centos 7


Did you archive it in Gitlab, or via some other method? If you don’t need it, I would just login to the Gitlab web interface and delete it from there. It will then get cleaned up, and you can most likely continue upgrading.

I wouldn’t attempt editing or deleting directly from the database.

Hi iwalker,

Yes, we already removed from admin interface, however gitlab keeps repository in data folder and database.

Gitlab uses a flag to mark repository as archived.

Another option could be fix repository .pack objects that are corrupted, but I don’t find anything about it that works for bare repository.


Maybe this cleanup can help if it has already been removed? Might do the trick.

maybe in particular the orphan one.

Usually if it had been deleted over 24 hours ago, it should have cleaned up already. Some of those commands will only be for Gitlab 12 and higher, so not sure how relevant it will be. Only thing I can find with google.


Sometime ago, we had removed that giant/problematic repository…

So, I decide to inspect database, and checking projects table his columns, I see that column archived has value TRUE and pending_delete with FALSE…so I run this update:

update projects set archived='f' where id=8;

At administrative interface, the repository appears again, and I did a remove again, and looking it at data folder, the folder was renamed to XYZ-old+8+deleted.git

According to the docs, some task/jog will remove from database and data folder.

1 Like


It works!


I think that had bug/crash during last time when gitlab try to remove/delete this repo. Now, it’s works.

Thanks for your help @iwalker :+1:

1 Like