Capistrano deployement Gitthub Permission denied (publickey)

DEBUG [68cf530c] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/api.test.com/git-ssh.sh /usr/bin/env git ls-remote --heads git@github.com:Medesko/api.test.com.git )
DEBUG [68cf530c] Permission denied (publickey).
DEBUG [68cf530c] fatal: Could not read from remote repository.
DEBUG [68cf530c]
DEBUG [68cf530c] Please make sure you have the correct access rights
DEBUG [68cf530c] and the repository exists.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::runner::ExecuteError: Exception while executing as root@api.medesko.com: git exit status: 128
git stdout: Nothing written
git stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I would be glad, if you could teach me what I can do to solve this problem.

Capistrano is using SSH to connect to the remote host.
Reading the error carefully it describes a problem making that connection.
First, verify you have SSH access to the host ‘manually’ (without running any scripts like Capistrano tasks).
If you are successful, from the same machine, with ssh root@api.medesko.com then Capistrano should not stumble.
This will require setting up the proper keys - for SSH communication - on your client and the host.
A simple Web search will yield numerous examples and descriptions how to do this. If your host is a provider like Digital Ocean they even offer tips and tools to make this very simple.

Most importantly: do not give up. Each time you struggle and find the solution to a problem you are LEARNING a new skill.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.