ruby-on-rails - 如何使用 capistrano 进行部署

标签 ruby-on-rails ruby linux git github

当我尝试运行bundle exec cap生产部署并登录到我的droplet时,出现此错误。我按照这个教程:https://gorails.com/deploy/ubuntu/18.04并已完成其中的所有操作,但它不起作用。

00:00 git:wrapper
  01 mkdir -p /tmp
✔ 01 deploy@167.99.85.170 0.147s
  Uploading /tmp/git-ssh-membercopy-production-root.sh 100.0%
  02 chmod 700 /tmp/git-ssh-membercopy-production-root.sh
✔ 02 deploy@167.99.85.170 0.141s
00:00 git:check
  01 git ls-remote git@github.com:Dekto/membercopy.git HEAD
  01 git@github.com: Permission denied (publickey).
  01 fatal: Could not read from remote repository.
  01
  01 Please make sure you have the correct access rights
  01 and the repository exists.
#<Thread:0x00007fffedb4ef20@/root/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        1: from /root/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/root/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@167.99.85.170: git exit status: 128 (SSHKit::Runner::ExecuteError)
git stdout: Nothing written
git stderr: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@167.99.85.170: git exit status: 128
git stdout: Nothing written
git stderr: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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


Caused by:
SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

Tasks: TOP => deploy:check => git:check
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@167.99.85.170: git exit status: 128
git stdout: Nothing written
git stderr: git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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


** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:


 DEBUG [fb6c095d] Command: [ -d $HOME/.rbenv/versions/2.5.3 ]

 DEBUG [d9437923] Finished in 12.154 seconds with exit status 0 (successful).

 DEBUG [ee4139eb] Running /usr/bin/env which passenger as deploy@167.99.85.170

 DEBUG [ee4139eb] Command: /usr/bin/env which passenger

 DEBUG [eaba4dfc] Finished in 0.147 seconds with exit status 1 (failed).

  INFO [9eeb8f8c] Running /usr/bin/env mkdir -p /tmp as deploy@167.99.85.170

 DEBUG [9eeb8f8c] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.3" ; /usr/bin/env mkdir -p /tmp )

  INFO [892841a3] Finished in 0.147 seconds with exit status 0 (successful).

 DEBUG Uploading /tmp/git-ssh-membercopy-production-root.sh 0.0%

  INFO Uploading /tmp/git-ssh-membercopy-production-root.sh 100.0%

  INFO [916f98f1] Running /usr/bin/env chmod 700 /tmp/git-ssh-membercopy-production-root.sh as deploy@167.99.85.170

 DEBUG [916f98f1] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.3" ; /usr/bin/env chmod 700 /tmp/git-ssh-membercopy-production-root.sh )

  INFO [fc59e4ba] Finished in 0.141 seconds with exit status 0 (successful).

  INFO [6d70b2b1] Running /usr/bin/env git ls-remote git@github.com:Dekto/membercopy.git HEAD as deploy@167.99.85.170

 DEBUG [6d70b2b1] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.3" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-membercopy-production-root.sh" ; /usr/bin/env git ls-remote git@github.com:Dekto/membercopy.git HEAD )

 DEBUG [a1aed7ca]       git@github.com: Permission denied (publickey).

 DEBUG [a1aed7ca]       fatal: Could not read from remote repository.



Please make sure you have the correct access rights

and the repository exists.

最佳答案

您需要将您的公钥放入 Github Keys页。一旦你这样做了,你就可以开始使用它了。

关于ruby-on-rails - 如何使用 capistrano 进行部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53248868/

相关文章:

ruby-on-rails - GraphQL Ruby N+1 批处理问题

sql - 如何拨驼峰柱

linux - 通过 icu 布局引擎计算字形

ruby-on-rails - 正则表达式匹配从字符串中获取正确数字的简单逻辑

ruby-on-rails - acts_as_audited。如何添加 "comment"列

ruby-on-rails - 测试失败,ActionView::Template::Error: undefined method `name' for nil:NilClass

ruby-on-rails - 为什么我的 View 变量没有插入括号内?

c++ - C++中的字符串类支持多少个字符?

c - 如何创建共享范围的文件?

ruby-on-rails - 如何在 rails3 中嵌入用户创建的 ruby​​ 程序