Start a Project

How to restore gitlab from backup

Gitlab is a tool for managing git repositories on a centralized server. Sometimes due to some reasons system crashes and we lose our valuable data. Therefore it is necessary to take regular backups of the gitlab server. So in case of any emergency we should be able to restore gitlab server with the backup data as soon as possible. In this tutorial I will show you how to restore a gitlab server from gitlab backup.

Before restoring gitlab you must consider the following points.

Restoring gitlab from backup

Put your backup file in /var/opt/gitlab/backups/ and change the ownership to git. To change the ownership, run the following command.

I have already put the back up file in /var/opt/gitlab/backups/

To restore a gitlab back up, run the following command.

Sometimes you can get this error. To resolve this error you must increase the RAM of your system and try again.

At last it will ask for rebuild an authorized_keys file. Select “no”.

Now, you have successfully restored your gitlab from the backup.

Suppose your backup filename is backup.tar. In this case you can not restore your data. Don’t worry, you have to only change the name to proper format. All you have to do is to get the exact timestamp of backup file.

Extract your backup file and read the backup_information.yml file.

backup_information.yml file is generally contains the following.

Now, you know when the backup was created. You need to generate the timestamp from these details.You need to focus the line backup_created_at. For generating timestamp go to http://www.timestampgenerator.com/

Enter all the details.

After you click on generate, it will show you the timestamp of the backup file.In my case the timestamp is 1468701528.

So I should rename my file to 1468701528_gitlab_backup.tar

Now, the name is in proper format. You can able to restore your gitlab from the backup.

If you have any doubts regarding restoration of gitlab backup, you can ask me in the comment.

IN CASE OF ANY QUERY,CONTACT US

Exit mobile version