By running sudo gitlab-rake gitlab:backup:create we can create backup for Gitlab manually. But is there any way to take Gitlab backup periodically, like daily or monthly.
PS: I want the backup file to be in Local folder not any cloud storage
2018: A good start would be the section "Configuring cron to make daily backups "
To schedule a cron job that backs up your repositories and GitLab metadata, use the root user:
sudo su - crontab -eThere, add the following line to schedule the backup for everyday at 2 AM:
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
Q4 2024: As noted by Esmaeele in the comments
In recent version of Gitlab, we have
gitlab-backupbinary comand.
So I use this line incrontabto backup gitlab repository each night at 01:000 01 * * * /usr/bin/gitlab-backup create SKIP=registry,packages,builds CRON=1See "Configuring cron to make daily backups"
Default backup keep time is Seven days.
Also as stated in link, we can change in/etc/gitlab/gitlab.rbunder thegitlab_rails['backup_keep_time'] = 604800section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With