我正在尝试在本地计算机上设置gitlab运行程序,执行程序是VirtualBox-Linux Ubuntu。但是,我花了超过2天的时间没有取得任何成功,并且遇到了各种各样的问题,并且互联网上的解决方案都没有帮助。
我现在得到的错误是:错误:准备失败:ssh:握手失败:ssh:无法进行身份验证,尝试使用方法[publickey none password],不支持任何方法
在我的本地计算机上(Windows 10 Enterprise)
我将GitLab-Runner服务设置为在我的管理员帐户下运行(如果没有遇到其他问题,如果我没记错的话-Runner无法克隆虚拟机)在Linux veritualmachine上(需要使用用户名和密码登录)
我安装了openssh
执行以下代码
chmod 600 ~/.ssh/id_rsa
chmod 700 ~/.ssh
创建〜/ .ssh / authorized_keys并将id_rsa文件添加到其中
我未注释sshd_config中的以下行
Port 22
PubkeyAuthentication yes
AuthurizationKeysFile .ssh/autherized_keys .ssh_authorized_keys2
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是作为虚拟机安装的linux ubuntu。
[runners.ssh]下的信息是我的Windows 10计算机的凭据
Linux -authorized_keys文件包含:
----BEGIN RSA PRIVATE KEY-----
THE KEY
----END RSA PRIVATE KEY------
。gitlab-ci.yml包含
# 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
因此,我希望它能够通过,因为脚本只是在创建文件夹,或者至少会因为代码出错而失败(在这种情况下,我不认为)
感谢您的帮助,如果需要更多信息,请告诉我。
runners.ssh部分应该是您要使用的虚拟机的信息。 Runners.virtualbox应该只包含base_name和disable_snapshots字段。
我也发现只有此版本有效:至少在我的经验中,virtualbox executor的https://github.com/ayufan/gitlab-ci-multi-runner。