ruby-on-rails - 我如何使用 capistrano 进行部署
问题描述
当我尝试运行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.
解决方案
您需要将您的公钥放在Github Keys页面中。一旦你这样做了,你就可以开始使用它了。
推荐阅读
- applescript - Alfred Workflow - 在带有可选参数的新窗口中搜索指定的 Web 浏览器
- c - 如何在准系统上正确执行 C 代码?
- vb.net - 如何在 Visual Basic 中从 DataGridView 更新 Access DB
- authentication - 身份验证测试失败,使用 Laravel、phpunit 和 Homestead
- google-sheets - 过滤除特定集合之外的所有值,删除重复项,删除另一个特定值,然后将结果加入一个单元格
- java - 使控制台中的命令在最后不带 \" 的情况下运行
- html - 我在导航 DIV 和 UL 列表之间存在未知空间问题
- vue.js - 动态更新值时如何更新vue.js中textarea的高度?
- http - 使用 HTTP Post 上传文件时,文件内容如何发送?
- c# - 如何使用计时器/延迟使对象或角色在控制台窗口中移动?