Problem
I am trying to setup a gitlab runner on my local machine and the executor is VirtualBox - Linux Ubuntu. However, I spent more than 2 days without any success and ran into all kind of issues and none of the solutions on the internet helped.
The error I am getting now is: ERROR: Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none password], no supported methods remain
What I did so far:
On My local machine (Windows 10 Enterprise)
- Enabled both ports 22 and 2200 for incoming connections.
- Created an id_rsa & id_rsa.pub and added it to GitLab. Copied to them another folder G:\ssh\ (I added my user and sshd user with full access)
- Added and registered GitLab-Runner under G:\GitLab-Runner folder
- I installed latest Virtualbox & setup Linux Ubuntu 18.04.1
- I set the GitLab-Runner service to run under my Administrator account (Without that I was running into another issues ~ If I remember correctly - the runner couldnt clone the virtual machines) On the Linux veritualmachine (Login required with username and password)
- I installed openssh
- Generated id_rsa & id_rsa.pub (Didnt add them to GitLab)
- Enabled Firewall and enabled sshd ports
- Enabled ports 22 (ssh) & 2200 ports as well
- Executed below code
chmod 600 ~/.ssh/id_rsa
chmod 700 ~/.ssh
- created ~/.ssh/authorized_keys and added the id_rsa file to it
- I Uncommented the below lines in sshd_config
Port 22
PubkeyAuthentication yes
AuthurizationKeysFile .ssh/autherized_keys .ssh_authorized_keys2
File contents/config
config.toml (gitlab-runner)
concurrent = 1
check_interval = 0
log_level = "debug"
[session_server]
session_timeout = 1800
[[runners]]
name = "dep-runner"
url = "https://gitlab.com/"
token = "gitlabrepository-key"
executor = "virtualbox"
[runners.ssh]
user = "WindowsUser"
password = "WindowsPassword"
port = "22"
identity_file = "G:/ssh/id_rsa"
[runners.virtualbox]
base_name = "DeploymentMachine"
user = "deployment"
password = "root"
identity_file = "/home/deployment/.ssh/id_rsa"
port = "22"
disable_snapshots = false
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
DeploymentMachine is the linux ubuntu installed as virtual machine.
Information under [runners.ssh] is the credentials for my Windows 10 machine
Linux - authorized_keys file contains:
public key
.gitlab-ci.yml contains
# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/plain-html
pages:
tags:
- dep-tag
stage: deploy
script:
- mkdir .public
- cp -r * .public
- mv .public public
artifacts:
paths:
- public
only:
- master
So I am expecting it either to pass since it the script is just creating folders, or at least to fail because something wrong regarding the code (which I dont think in this case)
Any help is appreciated, and if more info needed please let me know.