Развертывание Rails для постановки с использованием capistrano приводит к следующей ошибке
Я получаю следующее, когда пытаюсь выполнить развертывание на сервере, используя gem capistrano с моего локального компьютера (MAC) {Rails app}. Я новичок в рельсах
user-mbp:xp user$ cap staging deploy
Server password:
********
DEBUG [c6110f69] Running /usr/bin/env [ -d ~/.rbenv ] as deployer@server.com
DEBUG [c6110f69] Command: [ -d ~/.rbenv ]
DEBUG [c6110f69] Finished in 6.956 seconds with exit status 0 (successful).
INFO [e385c416] Running /usr/bin/env mkdir -p /tmp/pepe/ as deployer@server.com
DEBUG [e385c416] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.0.0-p353 /usr/bin/env mkdir -p /tmp/pepe/ )
INFO [e385c416] Finished in 0.098 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/pepe/git-ssh.sh 0.0%
INFO Uploading /tmp/pepe/git-ssh.sh 100.0%
INFO [191046c4] Running /usr/bin/env chmod +x /tmp/pepe/git-ssh.sh as deployer@server.com
DEBUG [191046c4] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.0.0-p353 /usr/bin/env chmod +x /tmp/pepe/git-ssh.sh )`enter code here`
INFO [191046c4] Finished in 0.119 seconds with exit status 0 (successful).
INFO [bd99c2fc] Running /usr/bin/env git ls-remote --heads ssh://git@git.xxx.xx.com/xp.git as deployer@server.com
DEBUG [bd99c2fc] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.0.0-p353 GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/pepe/git-ssh.sh /usr/bin/env git ls-remote --heads ssh://git@git.xxx.xx.com/xp.git )
DEBUG [bd99c2fc] Permission denied (publickey,password).
DEBUG [bd99c2fc] fatal: The remote end hung up unexpectedly
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deployer@server.com: git exit status: 128
git stdout: Nothing written
git stderr: Permission denied (publickey,password).
fatal: The remote end hung up unexpectedly
SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: Permission denied (publickey,password).
fatal: The remote end hung up unexpectedly
Я старался git:check
, но все еще показывая то же самое.
Tasks: TOP => git:check
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deployer@server.com: git exit status: 128
git stdout: Nothing written
git stderr: Permission denied (publickey,password).
fatal: The remote end hung up unexpectedly
Staging.rb
# *************************************************************** #
require 'highline'
set :stage, :staging
set :password, HighLine.new.ask('Server password:') { |q| q.echo = '*'}
server 'xx.x.com', user: 'deployer', password: fetch(:password), roles: %w{web app db}, primary: true
set :test_url, 'https://xx.x.com'
set :version, `git describe --always`
# you can set custom ssh options
# it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options
# you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start)
# set it globally
# set :ssh_options, {
# keys: %w(/home/rlisowski/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(password)
# }
# and/or per server
# server 'example.com',
# user: 'user_name',
# roles: %w{web app},
# ssh_options: {
# user: 'user_name', # overrides user setting above
# keys: %w(/home/user_name/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(publickey password)
# # password: 'please use keys'
# }
# setting per server overrides global ssh_options
# fetch(:default_env).merge!(rails_env: :staging)
1 ответ
Есть два возможных решения
Скопируйте свой личный ключ на компьютер для развертывания. Как вы можете отправить на Github (это я так понимаю), у вас есть личный ключ на компьютере разработчика и соответствующий открытый ключ на Github. Вы можете скопировать свой закрытый ключ на свой компьютер, чтобы избавиться от ошибки
машина развертывания $ scp ~/.ssh/id-rsa.pub-машина: ключ
Затем SSH к вашей машине развертывания и сделать
deployment-machine$ mv ~/.ssh/id-rsa.pub ~/.ssh/id-rsa.old
deployment-machine$ mv ~/key ~/.ssh/id-rsa.pub
- Создайте ключ на своем компьютере развертывания и добавьте открытый ключ в Github. Существует простое объяснение того, как это сделать, в справке Github.
Надеюсь это поможет.
Ссылки на проекты с использованием Capistrano
Если вы на Rails 3:
Если вы на Rails 4: