I’m trying out a GitLab install using Bitnami’s VirtualMachine appliance.
It almost works - except for the part where I’d like to connect to the repo via ssh.
After adding my ssh key to my gitlab user, and creating a project, I got the following error when I first tried to push to the repo.
tom@D03 /e/Code/Testing/testy (master) $ git push -u origin master firstname.lastname@example.org's password:
I.e. I was being prompted for a password where my ssh key should have been used for auth.
After a bit of searching, I found the following error in the sidekiq logs.
/opt/bitnami/apps/gitlab/gitlab-shell/lib/gitlab_keys.rb:36:in `initialize': Permission denied - /home/git/.ssh/authorized_keys (Errno::EACCES)
In my case, it turns out that the ownship of the /home/git/.ssh/authorized_keys file was incorrect. GitLab runs as the
git' user, but the authorized_keys file was owned by root’. The following command can be used to verify file ownership.
sudo ls -la /home/git/.ssh/authorized_keys*
To fix ownership, the following command works.
sudo chown git:git /home/git/.ssh/authorized_keys
That fixes the problem for future keys, but it doesn’t add the keys that we’re previously added to the system. To get things synced up again, execute this command in the gitlab folder. For the appliance, this was /opt/bitnami/apps/gitlab/htdocs
cd /opt/bitnami/apps/gitlab/htdocs sudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production