gpt4 book ai didi

ruby-on-rails - SSHKit::Runner::ExecuteError

转载 作者:行者123 更新时间:2023-12-03 13:40:46 24 4
gpt4 key购买 nike

$ bundle exec cap production deploy

(Backtrace restricted to imported tasks) cap aborted!
SSHKit::Runner::ExecuteError:
Exception while executing as Psara@sakura: git exit status: 128 git stdout: Nothing written git stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly

SSHKit::Command::Failed:
git exit status: 128
git stdout:Nothing written
git stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Tasks: TOP => git:check (See full trace by running task with --trace) The deploy has failed with an error:
Exception while executing as Psara@sakura:
git exit status: 128 git stdout: Nothing written
git stderr: Permission denied (publickey).

fatal: The remote end hung up unexpectedly



*

deploy.rb

set :application, 'Psara'
set :repo_url, 'git@bitbucket.org:CBLaughter/psara.git'
set :deploy_to, '/home/Psara/Psara'
set :default_run_options, :pty => true

namespace :deploy do

after :restart, :clear_cache do on roles(:web), in: :groups, limit: 3, wait: 10 do # Here we can do anything such as: # within release_path do # execute :rake, 'cache:clear' # end end end

end

set :ssh_options, { forward_agent: true, paranoid: true, keys: "~/.ssh/id_rsa" }



*

production.rb

set :stage, :staging
set :rails_env, :production

role :app, %w{sakura}
role :web, %w{sakura}
role :db, %w{sakura}

server 'sakura', user: 'Psara', roles: %w{web app}, my_property: >:my_value

set :ssh_options, {
keys: %w(~/.ssh/id_rsa),
forward_agent: false, }




如果你能教我如何解决这个问题,我会很高兴。

我已经在 bitbucket 上添加了一个公钥,但它不起作用。

*

SSH 代理转发报告


  1. [success] repo_url setting ok

  2. [success] ssh private key file exists

  3. [success] ssh-agent process seems to be running locally

  4. [success] ssh-agent process recognized by ssh-add command

  5. [success] ssh private keys added to ssh-agent

  6. [success] application repository accessible from local machine

  7. [success] all hosts using passwordless login

  8. [success] forward_agent ok for all hosts

  9. [success] ssh agent successfully forwarded to remote hosts

  10. [success] application repository accessible from remote hosts


It seems SSH agent forwarding is set up correctly! You can continue with the deployment process.

It succeeded in all tests, but still makes same error.

最佳答案

确保您的机器上运行了 ssh-agent,因为您使用的是 ssh 转发,您的本地 key 应该能够从 bitbucket 访问和克隆您的存储库。您可以使用以下命令运行代理:

eval `ssh-agent`
ssh-add ~/.ssh/id_rsa

有关 ssh 转发的更多信息,您可以 find here .

您应该手动检查的另一件事是您可以通过 ssh 连接到您的服务器(您的公钥应该添加到服务器上的 ~/.ssh/authorized_keys),当然您可以在本地克隆您的存储库(这可能是您能够做到的)。

更新:

现在我意识到您将转发用于生产,在这种情况下,您应该确保服务器上的 key 对(您必须拥有它,因为转发已关闭)能够从 bitbucket 克隆 repo,您​​可以尝试手动克隆到服务器上。

关于ruby-on-rails - SSHKit::Runner::ExecuteError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28375506/

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