Capistrano: Error reading response length from authentication socket.. and more

I tried everything, i read thousands of stack answers, i’m beginner, HELP

i bought the two screencast, composer(great) and capistrano i’m having issues

My workstation is Windows 7, vm, vagrant, VVV, Bedrock. I’m trying to deploy to a Digital Ocean LEMP

SSH works

SSH agent forwarding is working ok Redirecting...

$ ssh -T git@bitbucket.org
    logged in as mznbeijo.
    
    You can use git or hg to connect to Bitbucket. Shell access is disabled.

User with passwordless like capistrano ask(i guess)

and i get the following:

$ cap staging git:check

←[0;34;49mINFO←[0m[←[0;32;49m2fcf70dd←[0m] Running ←[0;33;49m/usr/bin/env mkdir -p /tmp/capis.dev/←[0m on ←[0;34;49mmysite.net←[0m
←[0;30;49mDEBUG←[0m[←[0;32;49m2fcf70dd←[0m] Command: ←[0;34;49m( WP_ENV=staging /usr/bin/env mkdir -p /tmp/capis.dev/ )←[0m
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.

Enter passphrase for c:/Users/jessenote/.ssh/id_rsa:**************

←[0;34;49mINFO←[0m[←[0;32;49m2fcf70dd←[0m] Finished in 5.737 seconds with exit status 0 (←[0;32;49msuccessful←[0m).
←[0;30;49mDEBUG←[0mUploading /tmp/capis.dev/git-ssh.sh 0.0%
←[0;34;49mINFO←[0mUploading /tmp/capis.dev/git-ssh.sh 100.0%
←[0;34;49mINFO←[0m[←[0;32;49m03ca38e5←[0m] Running ←[0;33;49m/usr/bin/env chmod +x /tmp/capis.dev/git-ssh.sh←[0m on ←[0;34;49mmysyte.net←[0m
←[0;30;49mDEBUG←[0m[←[0;32;49m03ca38e5←[0m] Command: ←[0;34;49m( WP_ENV=staging /usr/bin/env chmod +x /tmp/capis.dev/git-ssh.sh )←[0m
←[0;34;49mINFO←[0m[←[0;32;49m03ca38e5←[0m] Finished in 0.290 seconds with exit status 0 (←[0;32;49msuccessful←[0m).
←[0;30;49mDEBUG←[0m[←[0;32;49m5ddab61d←[0m] Running ←[0;33;49m/usr/bin/env git ls-remote -h git@bitbucket.org:mznbeijo/deploy.git←[0m on ←[0;34;49mmysite.net←[0m
←[0;30;49mDEBUG←[0m[←[0;32;49m5ddab61d←[0m] Command: ←[0;34;49m( WP_ENV=staging GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/capis.dev/git-ssh.sh /usr/bin/env git ls-remote -h git@bitbucket.org:mznbeijo/deploy.git )←[0m
←[0;30;49mDEBUG←[0m[←[0;32;49m5ddab61d←[0m] ←[0;31;49m  Error reading response length from authentication socket.
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m5ddab61d←[0m] ←[0;31;49m      Permission denied (publickey).
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m5ddab61d←[0m] ←[0;31;49m      fatal: Could not read from remote repository.
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m5ddab61d←[0m] ←[0;31;49m
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m5ddab61d←[0m] ←[0;31;49m      Please make sure you have the correct access rights
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m5ddab61d←[0m] ←[0;31;49m      and the repository exists.
←[0m←[0;30;49mDEBUG←[0m[←[0;32;49m5ddab61d←[0m] Finished in 1.610 seconds with exit status 128 (←[0;31;49mfailed←[0m).cap aborted!

SSHKit::Runner::ExecuteError: Exception while executing on host mysite.net: exit


SystemExit: exit

Tasks: TOP => git:check
(See full trace by running task with --trace)

Test from Cold Start Capistrano to check permissions is ok Cold Start

me@localhost $ bundle exec cap staging check_write_permissions
DEBUG [82c92144] Running /usr/bin/env [ -w /var/www/my-application ] on myserver.com
DEBUG [82c92144] Command: [ -w /var/www/my-application ]
DEBUG [82c92144] Finished in 0.456 seconds command successful.
INFO /var/www/my-application is writable on myserver.com

deploy.rb

set :application, 'capis.dev'
set :repo_url, 'git@bitbucket.org:mznbeijo/deploy.git'

set :branch, :master

set :deploy_to, -> { "/var/www/#{fetch(:application)}" }

set :log_level, :debug

set :linked_files, %w{.env}
set :linked_dirs, %w{web/app/uploads}

namespace :deploy do
  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      # Your restart mechanism here, for example:
      # execute :service, :nginx, :reload
    end
  end
end

staging.rb

set :stage, :staging

server 'mysite.net', user: 'myuser', roles: %w{web app db}

set :ssh_options, {
    keys: %w(~/.ssh/id_rsa)
  }


fetch(:default_env).merge!(wp_env: :staging)

Did you see this SO thread?

Check the reply and the comments under it about a Windows bug that’s been fixed.

You might have to update your net-ssh gem.

Thank you for answering. Actually i saw this thread, and i tested with other version of net-ssh that people have trouble, but didn’t work. But i will keep testing and i will try to do more changes in the net-ssh version and other tests. Any news i’ll post here

Thanks