天天看點

Gitlab更改倉庫存儲位置

參考:

http://stackoverflow.com/questions/19902417/change-the-data-directory-gitlab-to-store-repos-elsewhere

By default, omnibus-gitlab stores Git repository data under /var/opt/gitlab/git-data: repositories are stored in /var/opt/gitlab/git-data/repositories, and satellites in /var/opt/gitlab/git-data/gitlab-satellites. You can change the location of the git-data parent directory by adding the following line to /etc/gitlab/gitlab.rb.

ruby git_data_dir “/mnt/nas/git-data”

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

# Only move ‘repositories’; ‘gitlab-satellites’ will be recreated

# automatically. 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

繼續閱讀