
[英]GitLab CI denies access to push using a deploy key with write access
[英]Using Gitlab deploy keys with write access
我目前正在运行CE版本8.17.4,并且我正在尝试使用写访问权限设置部署密钥(截至8.16),以便我的运行时实例可以将构建工件提交回存储库。 我采取了以下步骤进行设置:
在runner实例上,我使用以下命令生成了ssh keypair:
sudo ssh-keygen -t rsa -C "label" -b 4096
生成的密钥对保存到/home/gitlab-runner/.ssh/id_rsa并受密码保护。
这是一个LaTeX文档存储库,因此在.gitlab-ci.yml文件中,我在构建pdf后发出以下脚本:
after_script: - "git commit -am 'autobuild PDF'" - "git push origin master"
提交更改后,构建在运行器上成功运行,直到git push origin master命令,并抛出此错误:
fatal: Authentication failed for 'http://gitlab-ci-token:xxxxxxxxxxxxxxxx@host/project.git/'
好。 几个问题:
谢谢你的帮助!
Jawad的评论对我有用:你需要强制SSH。 例如
git add remote ssh_remote git@host:user/project.git
git push ssh-remote HEAD:dev
谢谢下巴
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.