My gitlab installation is running out of space. I want to move the user's repositories to another drive. I can not find any walkthroughs or good forum posts about doing this.

I have tries moving /opt/gitlab/apps/gitlab/repositories to another drive, and then creating a symlink from the original folder name to the new one. This worked as far as it allowed me to read the data in the repositories, but it failed at the point of trying to create a new repo, when trying to push to the master branch (git push -u origin master), stating that I had no permission to commit to master. When I put the folder back in place instead of the symlink, all went back to working as expected.

Is there a better/correct way to move the repositories into a different location, and different drive on the system?

  • make sure you use chown git:git on all the GitLab related files.
    – fcm
    Jul 3 '19 at 16:46

It seems that the new parent directory on the new device has wrong permissions. Check owner, group, and permissions of the parent directory of all repositories on the old and the new location.

Also, in case it really is caused by the symlink (which I doubt), you could use mount --bind instead of a symlink to rebind the directory to the new disk.

  • could you elaborate on what the permissions should be on the new drive?
    – Billy Moon
    Nov 30 '13 at 2:47

assuming you set up pki / non-interactive authentication with github (ie. uploaded authenticated corresponding public key so that when you run git pull, your ~.ssh/id_dsa or ~..ssh/is_rsa private key is read for authentication).

the problem is most likely the corrensponsding private key is missning on the new device in:


make sure your private key is pasted over to that location, uid is correct, and chmod 0400 it or is wont work.


so once your public key is upped to github, anyone with the corresponding private key can download / change / delete your source code. if it has been compropised, you can revoke it and add another one as long as you have login atccess to github portal or access to email on file with github or change psassword / get into portal

private key should be kept offline and encrypted


Put you development team to a hold, you are about to change the configuration.

Create a directory on your new drive or a location with enough space, in my case, to give some future location independence, will use a link instead of an absolute location.

mkdir /drive2/repos # create a new base directory
ln -fs /drive2/repos /repos # create a link on the root
chown git:git /drive2/repos # make sure this is git friendly

now, using your favorite editor modify /etc/gitlab/gitlab.rb:

    "default" => {
        "path" => "/repos"

then use rsync or any other tool to copy the current location to the new one. You can delete later once you verify everything is working.

rsync -av /var/opt/gitlab/git-data/* /repos/.  # copy keeping all
chown -R git:git /repos/                       # reconfirm the ownership
# now reconfigure GitLab to the fire the new location
gitlab-ctl  reconfigure

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.