Change gitlab data directory to store repositories elsewhere

my main disk is full for my gitlab installation, is it possible to move repositories and their data to some other folder and make sure that upcoming push data is sent to these directories?

I tried stopping gitlab and copying the entire folder, but to no avail. PS - I'm not an IT guy, I'm just writing to see how we can get out of this problem; so please be careful when replying.

+43
git gitlab
Nov 11 '13 at 9:02
source share
4 answers

Just an update in case people are still referencing this. From the GitLab documentation:

By default, omnibus-gitlab stores Git repository data in the /var/opt/gitlab/git-data section. Vaults are stored in a subfolder of repositories . You can change the location of the git-data parent by adding the following line to /etc/gitlab/gitlab.rb .

 git_data_dirs({"default" => "/mnt/nas/git-data"}) 

Starting with GitLab 8.10, you can also add some Git data by adding the following lines to /etc/gitlab/gitlab.rb instead.

 git_data_dirs({ "default" => "/var/opt/gitlab/git-data", "alternative" => "/mnt/nas/git-data" }) 

Please note that the target directories and any of its subpaths should not be symbolic.

Run sudo gitlab-ctl reconfigure for the changes to take effect.

If you already have existing Git repositories in /var/opt/gitlab/git-data you can move them to a new location, as follows:

 # Prevent users from writing to the repositories while you move them. sudo gitlab-ctl stop # Note there is _no_ slash behind 'repositories', but there _is_ a # slash behind 'git-data'. sudo rsync -av /var/opt/gitlab/git-data/repositories /mnt/nas/git-data/ # Fix permissions if necessary sudo gitlab-ctl reconfigure # Double-check directory layout in /mnt/nas/git-data. Expected output: # gitlab-satellites repositories sudo ls /mnt/nas/git-data/ # Done! Start GitLab and verify that you can browse through the repositories in # the web interface. sudo gitlab-ctl start 
+95
Sep 16 '14 at 19:11
source share

Significantly easier solution for new installations with version> 7.14.1 :

Open the gitlab.rb configuration file

 sudo nano /etc/gitlab/gitlab.rb 

Find git_data_dir , uncomment the line and set your directory here, e.g.

 git_data_dir "/storage/data/gitlab/git-data" 

Save the file and reconfigure Gitlab:

 sudo gitlab-ctl reconfigure 
+8
Sep 01 '15 at 5:45
source share

I just moved the gitlab repository folder from one directory to another, can be useful for someone (do it quickly in a quiet time, or stop gitlab in advance!)

Assuming you have a standard installation, follow these steps:

  • Create a new folder for repositories as root and change ownership to git user
  • Copy (with archive, recursive parameters) the contents of the old repo folder to the new house cp -ar SOURCE DESTINATION
  • Edit gitlab config file and gitlab-shell configuration files with new repo path
  • Restart gitlab sudo /etc/init.d/gitlab restart
+3
Jan 21 '14 at 19:38
source share

If you get a "can't find repo" error in gitlab after completing the above steps. Run this command.

gitlab-rake cache: clear RAILS_ENV = production

This should fix the problem if your path is correct.

+1
Nov 07 '16 at 4:59
source share



All Articles