Windows上的gitlab runner未获取.ssh配置设置
我的回购协议依赖于其他回购协议 我正在尝试使用gitlab runner将二级回购克隆到Windows设备上 我的Windows上的gitlab runner未获取.ssh配置设置,git,ssh,gitlab,continuous-deployment,gitlab-ci-runner,Git,Ssh,Gitlab,Continuous Deployment,Gitlab Ci Runner,我的回购协议依赖于其他回购协议 我正在尝试使用gitlab runner将二级回购克隆到Windows设备上 我的gitlab ci.yml如下所示: # Deploy to a staging server deploy_staging: stage: deploy tags: - my_gitlab_runner script: - echo "Deploy to staging server" - cd C:/ - git
gitlab ci.yml
如下所示:
# Deploy to a staging server
deploy_staging:
stage: deploy
tags:
- my_gitlab_runner
script:
- echo "Deploy to staging server"
- cd C:/
- git clone git@gitlab.com:test_group/test_ci
environment:
name: staging
url: https://127.0.0.1
only:
- master
Host gitlab.com
Hostname altssh.gitlab.com
user git
Port 443
PreferredAuthentications publickey
IdentityFile C:/git_keys/my_gitlab_rsa
[[runners]]
name = "TestDesktop"
url = "https://gitlab.com"
token = "_yt...32fjJb"
tls-ca-file = "C:/my_certs/my_self_signed_ca.pem"
executor = "shell"
shell = "cmd"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
如果我登录到windows框,我可以使用git bash手动克隆REPO(我已经在C:/Users/myusername/.ssh
中设置了ssh设置)
我的.ssh配置如下所示:
# Deploy to a staging server
deploy_staging:
stage: deploy
tags:
- my_gitlab_runner
script:
- echo "Deploy to staging server"
- cd C:/
- git clone git@gitlab.com:test_group/test_ci
environment:
name: staging
url: https://127.0.0.1
only:
- master
Host gitlab.com
Hostname altssh.gitlab.com
user git
Port 443
PreferredAuthentications publickey
IdentityFile C:/git_keys/my_gitlab_rsa
[[runners]]
name = "TestDesktop"
url = "https://gitlab.com"
token = "_yt...32fjJb"
tls-ca-file = "C:/my_certs/my_self_signed_ca.pem"
executor = "shell"
shell = "cmd"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
我必须使用端口443,当通过gitbash进行操作时,它可以正常工作
作业不断失败,出现以下错误:
Cloning into 'test_ci'...
Host key verification failed.
fatal: Could not read from remote repository.
我已经将我的my_gitlab_rsa.pub
作为部署密钥添加到repo中,它可以在本地进行克隆,而不是通过gitlab运行程序
gitlab runner的config.toml如下所示:
# Deploy to a staging server
deploy_staging:
stage: deploy
tags:
- my_gitlab_runner
script:
- echo "Deploy to staging server"
- cd C:/
- git clone git@gitlab.com:test_group/test_ci
environment:
name: staging
url: https://127.0.0.1
only:
- master
Host gitlab.com
Hostname altssh.gitlab.com
user git
Port 443
PreferredAuthentications publickey
IdentityFile C:/git_keys/my_gitlab_rsa
[[runners]]
name = "TestDesktop"
url = "https://gitlab.com"
token = "_yt...32fjJb"
tls-ca-file = "C:/my_certs/my_self_signed_ca.pem"
executor = "shell"
shell = "cmd"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
有什么想法吗?这只是部分答案,但回答了我提出的问题强>
它归结为已知的\u主机
文件
当我以本地用户的身份运行它时,它会要求我验证指纹-它将指纹添加到known\u hosts
文件中
我刚刚将known_hosts
文件从本地用户复制/粘贴到系统帐户.ssh
目录,然后作业成功,没有问题
也就是说,我不确定实现自动化的最佳方法是什么,因为我不想每次都以本地用户的身份手动运行它来“接受指纹”,但我想这基本上回答了我的问题