gpt4 book ai didi

ruby-on-rails - Capistrano 失败,因为它无法连接到远程 git 存储库

转载 作者:行者123 更新时间:2023-12-02 13:50:13 25 4
gpt4 key购买 nike

我正在尝试使用 Capistrano 3.x 进行部署。

我在 ~/.ssh/config 文件中配置了代理转发:

Host git-codecommit.*.amazonaws.com
Hostname xxxx
ForwardAgent yes
IdentityFile /path/to/codecommit_rsa

我为我的服务器连接做了同样的事情 ForwardAgent yes还。

我验证了我的服务器还允许在/etc/ssh/sshd_config 文件中进行代理转发:
AllowAgentForwarding yes
  INFO ----------------------------------------------------------------
INFO START 2017-11-18 16:09:44 -0500 cap production deploy
INFO ---------------------------------------------------------------------------
INFO [b43ed70f] Running /usr/bin/env mkdir -p /tmp as deploy@50.116.2.15
DEBUG [b43ed70f] Command: /usr/bin/env mkdir -p /tmp
INFO [b43ed70f] Finished in 1.132 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/git-ssh-testapp-production-blankman.sh 0.0%
INFO Uploading /tmp/git-ssh-testapp-production-blankman.sh 100.0%
INFO [b1a90dc1] Running /usr/bin/env chmod 700 /tmp/git-ssh-testapp-production-blankman.sh as deploy@50.116.2.15
DEBUG [b1a90dc1] Command: /usr/bin/env chmod 700 /tmp/git-ssh-testapp-production-blankman.sh
INFO [b1a90dc1] Finished in 0.265 seconds with exit status 0 (successful).
INFO [b323707d] Running /usr/bin/env git ls-remote ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/fuweb HEAD as deploy@50.116.2.15
DEBUG [b323707d] Command: ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-testapp-production-blankman.sh" ; /usr/bin/env git ls-remote ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/fuweb HEAD )
DEBUG [b323707d] Permission denied (publickey).
DEBUG [b323707d] fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我在这里想念什么?

最佳答案

您需要让 Capistrano 知道您希望它转发您的本地 key 。这可以通过进入您项目的 config/deploy.rb 来完成。并添加这一行:

ssh_options[:forward_agent] = true

IIRC,Capistrano 通过 SSHKit 远程执行命令, 所以即使你调用 ssh-agent并在本地添加一个 key ,我不能说它是否会持续到下一个命令。

关于ruby-on-rails - Capistrano 失败,因为它无法连接到远程 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47371130/

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