gpt4 book ai didi

git - 使用远程主机 gitlab 从 Windows 部署 capifony 时权限被拒绝(公钥)

转载 作者:太空狗 更新时间:2023-10-29 13:46:59 25 4
gpt4 key购买 nike

我正在尝试使用 capifony 通过 gitlab 从我的本地 Windows 计算机设置部署到我的服务器。

通常我会通过 ssh 连接到我的服务器并从服务器运行命令现在我想在我的本地计算机上执行此操作。

我已经在使用 git 将代码从本地计算机推送到 gitlab,即我的公钥已在 gitlab 上注册。

然而,在这里,它不适用于 capifony。可能是什么问题?

错误:

D:\Divers\Programmation\Web\foodmeup.dev>cap development deploy
** transaction: start
--> Updating code base with remote_cache strategy
*** [deploy:update_code] rolling back
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my_server_ip (ArgumentError: Could not parse PKey: no start line)
connection failed for: my_server_ip (ArgumentError: Could not parse PKey: no start line)

编辑:

如果我按照几个帖子中给出的说明进行操作,并将以下选项放入我的 deploy.rb

ssh_options[:keys] = %w('~/.ssh/id_rsa')

ssh_options[:keys] = %w('~/.ssh/id_rsa.pub')

然后我被要求输入 root 密码,但我仍然收到错误消息(尽管我可以使用 putty 直接通过 ssh 登录,并且无需我输入 root 密码就可以与另一个用户一起从我的服务器运行部署):

D:\Divers\Programmation\Web\foodmeup.dev>cap preprod deploy
** transaction: start
--> Updating code base with remote_cache strategy
root@my_server_ip's password:
** [my_server_ip :: err] Error reading response length from authentication socket.
** [my_server_ip :: err] Permission denied (publickey).
** [my_server_ip :: err] fatal: Could not read from remote repository.
**
** Please make sure you have the correct access rights
** and the repository exists.
*** [deploy:update_code] rolling back
failed: "sh -c 'if [ -d /home/foodmeup.net/preprod/shared/cached-copy ]; then cd /home/foodmeup.net/preprod/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --ha
rd f52737bb09edbd968319400e2d535f467c42b04c && git clean -q -d -x -f; else git clone -q -b preprod git@gitlab.com:svassaux/foodmeup.git /home/foodmeup.net/preprod/shared/cached-copy && cd /home/foodme
up.net/preprod/shared/cached-copy && git checkout -q -b deploy f52737bb09edbd968319400e2d535f467c42b04c; fi'" on my_server_ip

最佳答案

this issue 中所述,一个可能的原因是:

My problem was that I needed to enclose my ssh key file location in quotes in my config/deploy.rb file, like this:

ssh_options[:keys] = %w('~/.ssh/id_rsa.pub')

instead of:

ssh_options[:keys] = %w(~/.ssh/id_rsa.pub)

还有:

I got this error even when I dont set ssh_options[:keys] in my deploy.rb.

或者:

This problem may be caused by ssh private key with passphrase and no ssh public key.

(也在 issues/101 中提到)

Try remove ssh_options[:keys] and invoke the following command:

ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub

这导致:

I launched ProcessMonitor and found ruby process trying to load file ~.ssh\key.pub.pub which gave me an idea that path to the private (not public) key should be in ssh_config['keys'].

So this should work:

ssh_options[:keys] = %w('~/.ssh/id_rsa')

另请阅读 ArgumentError: Could not parse PKey: no start line

关于git - 使用远程主机 gitlab 从 Windows 部署 capifony 时权限被拒绝(公钥),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31751669/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com