sameersbn / docker-gitlab-ci-multi-runner

MIT License
145 stars 85 forks source link

SSH deploy key isn't available to runner #10

Closed davidwindell closed 8 years ago

davidwindell commented 8 years ago

The deploy keys don't appear to be usable by runners that want to git clone during a build phase.

I have copied id_rsa.pub from the containers /home/gitlab_ci_multi_runner/data/.ssh into Deploy Keys for a project but still get "Host key verification failed".

gitlab-ci-multi-runner 0.6.2 (3227f0a)
Using Shell executor...
Running on gitlab-ci-1...

Fetching changes...
Checking out 21ac0542 as master...

$ mkdir deploy
$ cd deploy
$ git clone git@git.xyz.com:my/repo.git -b production --single-branch .
Cloning into '.'...
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

ERROR: Build failed with: exit status 1
davidwindell commented 8 years ago

Ah, ignore this, I missed that it was the Host key that was failing. Adding;

ssh-keyscan -H 'git.xyz.com' >> $HOME/.ssh/known_hosts to the build step fixed this.

sameersbn commented 8 years ago

ssh-keyscan github.com | sort -u - ~/.ssh/known_hosts -o ~/.ssh/known_hosts may help avoid duplicate entries in the known_hosts