GitLab生产部署-权限被拒绝(公钥)

时间:2020-05-22 07:25:55

标签: laravel docker deployment gitlab laravel-envoy

这是我第一次使用GitLab或Docker映像部署Laravel应用程序,我可能对此过程有些困惑。

我遵循了本指南:laravel_with_gitlab_and_envoy,在开始部署之前,一切似乎都可以进行。 我可以看到我的文件实际上已上传到服务器,但是部署作业始终以错误结束。

目标生产服务器是简单的共享主机,并且我在那里建立了ssh连接(尽管sudo似乎不起作用,所以例如,我无法编辑实际的ssh配置)。

我对@server的{​​{1}}指令有点困惑,并且在那里已经尝试过不同的凭据。但是现在我很确定我应该将Envoy.blade.php放在那儿,但是GitLab部署工作因以下错误而结束:

ssh_username@production_ip

现在我不确定我缺少哪些权限,因为主应用程序文件已经上传到$ [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config $ ~/.composer/vendor/bin/envoy run deploy --commit="$CI_COMMIT_SHA" [ssh_username@production_ip]: Cloning repository [ssh_username@production_ip]: Cloning into 'app/releases/20200522043301'... [ssh_username@production_ip]: Permission denied (publickey). [ssh_username@production_ip]: fatal: Could not read from remote repository. [ssh_username@production_ip]: Please make sure you have the correct access rights [ssh_username@production_ip]: and the repository exists. [✗] This task did not complete successfully on one of your servers. 。这是否表示由于某种原因无法从GitLab或其他工具获取发布文件?

还是在这一点上我的Docker映像可能有问题?

1 个答案:

答案 0 :(得分:0)

呵呵,我终于找到了问题。我必须手动创建具有以下内容的.ssh/config文件:

Host gitlab.com
User git
Hostname gitlab.com
IdentityFile ~/.ssh/deploy_key
TCPKeepAlive yes
IdentitiesOnly yes

现在部署过程终于也可以上传发行版本了!