Skip to content

Instantly share code, notes, and snippets.

@omps
Created March 8, 2016 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omps/fdb653d12e78f2d6d604 to your computer and use it in GitHub Desktop.
Save omps/fdb653d12e78f2d6d604 to your computer and use it in GitHub Desktop.
Storing Git data in an alternative directory
y default, omnibus-gitlab stores the Git repository data under /var/opt/gitlab/git-data. The repositories are stored in a subfolder repositories. You can change the location of the git-data parent directory by adding the following line to /etc/gitlab/gitlab.rb.
git_data_dir "/mnt/nas/git-data"
Note that the target directory and any of its subpaths must not be a symlink.
Run sudo gitlab-ctl reconfigure for the change to take effect.
If you already have existing Git repositories in /var/opt/gitlab/git-data you can move them to the 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment