GitLab delete Backups and gain Disk-Space

You can change BACKUPDAYS=7 to a number you want. It’s set for 7 days more or less. Its possible to then set up a cronjob to runs that script once a day or something.

				
					#!/bin/bash
#
# Delete old gitlab backups

# Variables
GITLABBACKUPS=/var/opt/gitlab/backups
BACKUPDAYS=7

# Cleanup old backups
find $GiTLABBACKUPS -type f -ctime +$BACKUPDAYS -exec rm -f {} \;
				
			

For single execution:

				
					find /var/opt/gitlab/backups -type f -ctime +7 -exec rm -f {} \;

				
			

Limit backup lifetime for configuration backups (prune old backups)

This is also possible in addition to deleteing old backups. See the official Documentation.

git-filter-repo Manual installation

If for some reason you don’t want to use pip, you can also just:

				
					mkdir -p ~/bin
curl -o ~/bin/git-filter-repo https://raw.githubusercontent.com/newren/git-filter-repo/main/git-filter-repo
chmod +x ~/bin/git-filter-repo