capistrano 3无法访问在vps上部署的git存储库

时间:2014-07-02 11:11:00

标签: ruby-on-rails deployment ssh capistrano

请帮忙!不知道从哪里开始

deploy.rb     锁定3.1.0'     设置:应用程序,' baza'     set:deploy_to,' / home / deploy / baza'     set:repo_url," deploy@100.100.100.100:/home/deploy/git/baza.git"

set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle    public/system}

namespace :deploy do

 desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
  execute :touch, release_path.join('tmp/restart.txt')
end
end

after :publishing, 'deploy:restart'
after :finishing, 'deploy:cleanup'
end

并获得错误

←[0;34;49mINFO←[0m[←[0;32;49md08a4f3a←[0m] Running ←[0;33;49m/usr/bin/env mkdir-p /tmp/baza/←[0m on ←[0;34;49m107.170.154.188←[0m
←[0;30;49mDEBUG←[0m[←[0;32;49md08a4f3a←[0m] Command: ←[0;34;49m/usr/bin/env mkdir -p /tmp/baza/←[0m
←[0;34;49mINFO←[0m[←[0;32;49md08a4f3a←[0m] Finished in 5.022 seconds with exit status 0 (←[0;32;49msuccessful←[0m).
←[0;30;49mDEBUG←[0mUploading /tmp/baza/git-ssh.sh 0.0%
←[0;34;49mINFO←[0mUploading /tmp/baza/git-ssh.sh 100.0%
[0;34;49mINFO←[0m[←[0;32;49me25bbb96←[0m] Running ←[0;33;49m/usr/bin/env chmod+x /tmp/baza/git-ssh.sh←[0m on ←[0;34;49m107.170.154.188←[0m
←[0;30;49mDEBUG←[0m[←[0;32;49me25bbb96←[0m] Command: ←[0;34;49m/usr/bin/env chmod +x /tmp/baza/git-ssh.sh←[0m
←[0;34;49mINFO←[0m[←[0;32;49me25bbb96←[0m] Finished in 0.774 seconds with exit status 0 (←[0;32;49msuccessful←[0m).
[0;30;49mDEBUG←[0m[←[0;32;49m2a0546ea←[0m] Running ←[0;33;49m/usr/bin/env git ls-remote deploy@100.100.100.100:/home/deploy/git/baza.git←[0m on             ←[0;34;49m107.170.154.188←[0m
←[0;30;49mDEBUG←[0m[←[0;32;49m2a0546ea←[0m] Command: ←[0;34;49m( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/baza/git-ssh.sh /usr/bin/env git ls-remote deploy@100.100.100.100:/home/deploy/git/baza.git )←[0m
←[0;30;49mDEBUG←[0m[←[0;32;49m2a0546ea←[0m] ←[0;31;49m  Error reading response length from authentication socket.
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m2a0546ea←[0m] ←[0;31;49m      Permission denied (publickey,password).
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m2a0546ea←[0m] ←[0;31;49m      fatal: Could not read from remote repository.
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m2a0546ea←[0m] ←[0;31;49m
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m2a0546ea←[0m] ←[0;31;49m      Please make sure you have the correct access rights
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m2a0546ea←[0m] ←[0;31;49m      and the repository exists.
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m2a0546ea←[0m] Finished in 1.238 seconds with exit     status 128 (←[0;31;49mfailed←[0m). cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 100.100.100.100:

请告诉我从哪里开始!

3 个答案:

答案 0 :(得分:0)

请检查

:repo_url, "deploy@100.100.100.100:/home/deploy/git/baza.git"

你确定你的git用户是"部署"?

答案 1 :(得分:0)

我们遇到的问题是我们的解决方案添加到 deploy.rb

set :ssh_options, {
  keys: %w(/home/usuario/.ssh/id_rsa),
  forward_agent: false,
  auth_methods: %w(publickey)
}

并且效果很好!!

答案 2 :(得分:0)

  1. 通过VPS
  2. 登录您的SSH

    并运行

    deploy@baza:~$ ssh -T git@github.com
    deploy@baza:~$ ssh -T git@bitbucket.org
    deploy@baza:~$ ssh-keygen -t rsa
    deploy@baza:~$ cat ~/.ssh/id_rsa.pub
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+... deploy@baza
    
    1. 将生成的公钥~/.ssh/id_rsa.pub添加为例如Baza deploy@100.100.100.100到您的GitHub / BitBucket Baza存储库SSH Keys设置部分。

    2. 重新上传项目。