Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change the data directory gitlab to store repos elsewhere

Tags:

git

gitlab

my basic disk is full for my gitlab installation, is it possible to move the repositories and their data to some other folder and make sure that the upcoming push's data is sent to those directories?

I tried stopping the gitlab and copying over the entire folder, but to no avail. PS - I am not an IT guy, I am just pitching in to see how could we get out of this issue; so please be verbose when answering.

like image 297
Brij Raj Singh - MSFT Avatar asked Nov 11 '13 09:11

Brij Raj Singh - MSFT


People also ask

Where does GitLab server store repositories?

GitLab stores repositories on repository storage. Repository storage is either: A gitaly_address , which points to a Gitaly node. A path , which points directly to the directory where the repositories are stored.

How do I move a GitLab project to another group?

Transferring an existing project into a group You can transfer an existing project into a group you own from the project settings page. First scroll down to the 'Dangerous settings' and click 'Show them to me'. Now you can pick any of the groups you manage as the new namespace for the group.


1 Answers

Just updating in case people still refer to this. From the GitLab documentation:

By 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_dirs({"default" => "/mnt/nas/git-data"}) 

Starting from GitLab 8.10 you can also add more than one git data directory 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" }) 

Note that the target directories and any of its subpaths must not be a symlink.

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 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 
like image 154
Gus E Avatar answered Sep 23 '22 18:09

Gus E