GitLab: SSH key does not work
After setting up GitLab server I found git operations via SSH did not work. I tried the following:
- rake gitlab:check to check for any obvious errors
- rake gitlab:shell:setup as suggested in this ticket, there is another more recently opened ticket
- regenerate SSH client keys
- checking the permissions of /usr/local/git/.ssh and /home/git/.ssh for git user
Everything from the above seemed to check out.
However the root cause in my case turned out to be that the location of the authorized_keys file for git user needed to be updated in the GitLab YAML configuration file gitlab.yml from:
## GitLab Shell settings
gitlab_shell:
path: /usr/local/share/gitlab-shell/
authorized_keys_file: /usr/local/git/.ssh/authorized_keys
to:
## GitLab Shell settings
gitlab_shell:
path: /usr/local/share/gitlab-shell/
authorized_keys_file: /home/git/.ssh/authorized_keys
Then after re-running rake gitlab:shell:setup a git user’s SSH started working.
This appeared to be the FreeBSD port specific issue where gitlab.yml.example was patched replacing /home with /usr/local prefix for paths in the YAML configuration file.