简体   繁体   English

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

[英]capistrano 3 cannot access git repository deploying on vps

please help! 请帮忙! have no idea where to start 不知道从哪里开始

deploy.rb lock '3.1.0' set :application, 'baza' set :deploy_to, '/home/deploy/baza' set :repo_url, "deploy@100.100.100.100:/home/deploy/git/baza.git" deploy.rb锁'3.1.0'设置为:application,'baza'设置为:deploy_to,'/ home / deploy / baza'设置为: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

and get the error 并得到错误

←[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:

please give me a clue where to start! 请给我一个线索,从哪里开始!

please check 请检查

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

Are you sure your git user is "deploy"? 您确定您的git用户是“部署”吗?

we live the same problem our solution was add to deploy.rb : 我们遇到了同样的问题,我们的解决方案被添加到deploy.rb

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

and works great!! 而且效果很好!

  1. Login to your VPS via SSH 通过SSH登录到VPS

and run 并运行

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. Add generated public key ~/.ssh/id_rsa.pub for example as Baza deploy@100.100.100.100 to your GitHub / BitBucket Baza repository SSH Keys settings section. 将生成的公钥~/.ssh/id_rsa.pub例如作为Baza deploy@100.100.100.100到您的GitHub / BitBucket Baza存储库SSH Keys设置部分。

  2. Re-upload project. 重新上传项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM