I am trying to setup a deployment from my local windows computer through gitlab to my server using capifony.
Usually I would connect by ssh to my server and run the command from the server Now I want to do it from my local computer.
I am already pushing code from my local computer to gitlab with git, i.e. my public key is registered on gitlab.
Here however, it's not working with capifony. What could be the issue ?
The error :
D:\Divers\Programmation\Web\foodmeup.dev>cap development deploy
** transaction: start
--> Updating code base with remote_cache strategy
*** [deploy:update_code] rolling back
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my_server_ip (ArgumentError: Could not parse PKey: no start line)
connection failed for: my_server_ip (ArgumentError: Could not parse PKey: no start line)
EDIT :
If I follow the instructions given in several post and I put in my deploy.rb the following options
ssh_options[:keys] = %w('~/.ssh/id_rsa')
or
ssh_options[:keys] = %w('~/.ssh/id_rsa.pub')
Then I am asked for a root password and I still get an error (despite the fact I can log in via ssh with putty directly and that running the deployment from my server with another user works without me entering the root password):
D:\Divers\Programmation\Web\foodmeup.dev>cap preprod deploy
** transaction: start
--> Updating code base with remote_cache strategy
[email protected]_server_ip's password:
** [my_server_ip :: err] Error reading response length from authentication socket.
** [my_server_ip :: err] Permission denied (publickey).
** [my_server_ip :: err] fatal: Could not read from remote repository.
**
** Please make sure you have the correct access rights
** and the repository exists.
*** [deploy:update_code] rolling back
failed: "sh -c 'if [ -d /home/foodmeup.net/preprod/shared/cached-copy ]; then cd /home/foodmeup.net/preprod/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --ha
rd f52737bb09edbd968319400e2d535f467c42b04c && git clean -q -d -x -f; else git clone -q -b preprod [email protected]:svassaux/foodmeup.git /home/foodmeup.net/preprod/shared/cached-copy && cd /home/foodme
up.net/preprod/shared/cached-copy && git checkout -q -b deploy f52737bb09edbd968319400e2d535f467c42b04c; fi'" on my_server_ip
As mentioned in this issue, one possible reason is:
My problem was that I needed to enclose my ssh key file location in quotes in my
config/deploy.rb
file, like this:
ssh_options[:keys] = %w('~/.ssh/id_rsa.pub')
instead of:
ssh_options[:keys] = %w(~/.ssh/id_rsa.pub)
Also:
I got this error even when I dont set
ssh_options[:keys]
in mydeploy.rb
.
Or:
This problem may be caused by ssh private key with passphrase and no ssh public key.
(also mentioned in issues/101)
Try remove
ssh_options[:keys]
and invoke the following command:
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
That leads to:
I launched ProcessMonitor and found ruby process trying to load file
~.ssh\key.pub.pub
which gave me an idea that path to the private (not public) key should be inssh_config['keys']
.So this should work:
ssh_options[:keys] = %w('~/.ssh/id_rsa')
Read also ArgumentError: Could not parse PKey: no start line