Git clone ends with "Permission denied (publickey)"
Hi all,
I'm currently trying to deploy a new instance of GitLab CE to Kubernetes (IBM Cloud). But after (each) start of the container, I'm not able to clone or even access a repository (the SSH key is correct) because of the following error:
stdout:
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
In order to find out the cause of this error I logged in into the running container and started the command gitlab-ctl tail and here is the output:
==> /var/log/gitlab/sshd/current <==
2018-06-06_15:14:30.53220 Authentication refused: bad ownership or modes for directory /var/opt/gitlab
2018-06-06_15:14:30.53322 Connection closed by 172.30.200.19 port 36098 [preauth]
And here how the permissions on this folder look like:
total 80
drwxr-xr-x 18 nobody 4294967294 4096 Aug 3 08:18 .
drwxr-xr-x 1 root root 4096 Jun 6 21:39 ..
drwx------ 2 git git 4096 Aug 1 10:16 .cache
-rw-r--r-- 1 git git 292 Aug 1 10:05 .gitconfig
drwx------ 2 git git 4096 Aug 1 10:13 .ssh
drwxr-x--- 3 gitlab-prometheus git 4096 Aug 3 08:18 alertmanager
drwx------ 2 git git 4096 Aug 1 10:05 backups
-rw------- 1 git git 38 Aug 1 10:06 bootstrapped
drwx------ 3 git git 4096 Aug 1 10:05 git-data
drwx------ 2 git git 4096 Aug 3 08:19 gitaly
drwxr-xr-x 3 git git 4096 Aug 1 10:05 gitlab-ci
drwxr-xr-x 2 git git 4096 Aug 3 08:18 gitlab-monitor
drwxr-xr-x 9 git git 4096 Aug 3 08:18 gitlab-rails
drwx------ 2 git git 4096 Aug 3 08:18 gitlab-shell
drwxr-x--- 2 git gitlab-www 4096 Aug 3 08:19 gitlab-workhorse
drwx------ 3 git git 4096 Aug 3 08:18 logrotate
drwxr-x--- 9 nobody gitlab-www 4096 Aug 3 08:19 nginx
drwxr-xr-x 3 git git 4096 Aug 1 10:06 node-exporter
drwxr-x--- 3 gitlab-prometheus git 4096 Aug 3 08:18 prometheus
-rw-r--r-- 1 git git 179 Aug 3 08:19 public_attributes.json
drwxr-x--- 2 gitlab-redis git 4096 Aug 3 08:19 redis
-rw-r--r-- 1 git git 40 Aug 3 08:18 trusted-certs-directory-hash
Afterwards I changed the ownership of the git home folder to git.git and this step fixed my git clone problem. But after a restart the permissions are reverted. This occurs only by kubernetes not in docker!
Does someone knows something about?
Best Regards, Nikolay