Search code examples
gitgitlabmountsshfs

Import external repositories to Gitlab with sshfs


Is that possible to have all repositories on some local server and also browse it with Gitlab (hosted on other local server)?

I use Gitlab v8.3.3. and I have a following situation:
- I have all of my repositories stored at local server, say: 192.168.5.5 at /git
- I also have a local virtual machine that hosts Gitlab, at: 192.168.5.6
- I mounted my local git server at git-data directory (that's where repositories are being kept) by running:
sshfs my.user@192.168.5.5:/git /var/opt/gitlab/git-data/repositories/server-group

server-group is an empty directory created by Gitlab when I created a new group with the same name.

Now I would like to be able to browse repositories mounted this way via Gitlab.
Is that possible?

I believe it should be but it needs some extra configuration?
Of course simple: gitlab-ctl reconfigure or gitlab-ctl restart doesn't help and Gitlab group server-group has 0 projects even though in it's directory I have valid "repos.git".


Solution

  • I resolved this issue by:
    1. creating empty repositories with the same name using GitLab API

    curl -k --header "PRIVATE-TOKEN: <your_private_token>" -H "Content-Type: application/json" -d '{"name":"<name_here>","path":"<the_same_name_here>","visibility_level":"10","namespace_id":"<id_of_my_group>"}' "https://192.168.5.6/api/v3/projects"


    2. mounting our repositories as described in How can I use GitLab on one server and store all of the repositories on another? (including changing permissions - see answer)