Using Ubuntu 18.04 via a Vagrant Virtualbox VM I migrated a back up from my VPS to a VM at home.

This document was made using the guide available at:

You may want to check your git repo for issues (for more information see

sudo gitlab-rake gitlab:git:fsck
sudo gitlab-rake gitlab:artifacts:check
sudo gitlab-rake gitlab:lfs:check
sudo gitlab-rake gitlab:uploads:check

In old VM:
Backup Gitlab Environment (12.1 and earlier):

sudo gitlab-rake gitlab:backup:create

Backup Gitlab Environment (12.2 and later):

sudo gitlab-backup create

In your new VM:
Create file:

sudo vim /etc/apt/sources.list.d/gitlab_gitlab-ce.list

Enter data:

# this file was generated by for
# the repository at

deb bionic main
deb-src bionic main

Get the GPGKEY

curl -L | sudo apt-key add -

You will need to go to and search at the top for your version, click on the appropriate distribution, and then look on the right where they have the text to copy to install.

Example: Version 13.3.6 reads as:

sudo apt-get install gitlab-ce=13.3.6-ce.0


sudo apt-get update
sudo apt-get install gitlab-ce=[your old gitlab version]

Look in your Gitlab Environment on the Admin page, it is listed on the right. Also it is generally saved in the filename of the backup.

sudo gitlab-ctl reconfigure
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop puma
sudo gitlab-ctl stop sidekiq
sudo gitlab-ctl status

Copy your backup file to the backup directory

sudo mv backup.tar /var/opt/gitlab/backups/

Set the ‘git:root’ user as owner

sudo chown git:root -R /var/opt/gitlab/backups

Restore your Gitlab environment (12.1 and earlier):
Note, it will append ‘_gitlab_backup.tar’ to the end of the file name you put after the ‘=’ sign

sudo gitlab-rake gitlab:backup:restore BACKUP=

Restore your Gitlab environment (12.2 and later):
Note, it will append ‘_gitlab_backup.tar’ to the end of the file name you put after the ‘=’ sign

sudo gitlab-backup restore BACKUP=
sudo gitlab-ctl reconfigure

Copy your secrets back

sudo mv gitlab-secrets.json /etc/gitlab/gitlab-secrets.json

Reconfigure, restart, and check

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true

Add  a backup cron tab entry (04:03 AM on Sunday)

3 4 * * 0 gitlab-backup create > /root/gitlabbackup.log

That’s all, thanks!

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.