如何使用Capistrano进行部署

时间:2018-11-11 12:44:10

标签: ruby-on-rails ruby linux git github

当我尝试运行bundle exec cap production deploy并登录到我的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.

1 个答案:

答案 0 :(得分:0)

您需要将公共密钥放在Github Keys页中。完成后,您就可以开始使用它了。