How to recover my repository from Gitlab?

I updated GitLab. But he failed. All my repositories have been deleted. How can I get them back? I did not back up before the run

You need a backup to be able to restore stuff. How else would it be possible to get it back? You didn’t make any VM snapshots beforehand? No backup under /var/opt/gitlab/backups?

There is no backup under /var/opt/gitlab/backups

Can you check to make sure repository data has actually been deleted?

~# ls /var/opt/gitlab/git-data/repositories/

and post the results so that we can see. Please copy and paste the text, please do not post screenshots of it.

Also check the size of the repositories directory just to make sure:

~# du -sh /var/opt/gitlab/git-data/repositories/

same again, copy and paste the screen text, please do not post screenshot.

Also, please explain more about your upgrade process. What upgrade version were you on before you started? What upgrade procedure did you follow? Did you follow the upgrade path?

If the directory of repositories is empty, then was this by any chance mounted as NFS? Do you still have this somewhere? Maybe it’s not mounted because NFS was deprecated so you might have an option to import from the NFS directory.

We really need a lot more info from you to help, but if you don’t have a backup, and you don’t have anything in the repositories data, then I am sorry to say but you will not be able to recover your server.

Backups are extremely important, especially when doing things like upgrades where things can go wrong.

1 Like

Hello
[root@svn ~]# ls /var/opt/gitlab/git-data/repositories/
+gitaly pegah_hoseinian
[root@svn ~]# du -sh /var/opt/gitlab/git-data/repositories/
80K /var/opt/gitlab/git-data/repositories/
[root@svn ~]#

I run this command for update: yum update
My Gitlab version is: 12.10.14 (fe3e5d62b3e)

Gitlab version now is 12.10.14 or before upgrade it was 12.10.14? If before, then this was one of the biggest mistakes you made. You should have checked and read the Gitlab upgrade docs first. Doing the standard yum update would make you go to the latest version without following the upgrade path.

The second biggest mistake was not making a backup beforehand.

The only thing you can do now is make a new clean install of Gitlab, and then commit all your repositories to your new installation. Hopefully you have them all downloaded somewhere on one of your computers to be able to do this.

1 Like

My last Gitlab version was 12.10.14.

Is there any way to restore my old repository file?

Where do you suppose to restore it from when you don’t have a backup? So therefore, you will have to make a new clean install, and assuming that you have everything cloned locally, you can then push it to the new server and start from zero.