Deploying using Github actions in Digital ocean docker username and password error

Viewed 310

From my local PC, I am able to successfully SSH using

me@ubuntu:~$ ssh -o StrictHostKeyChecking=no root@147.182.255.130 whoami
root

When I push my code to github I get the following error pm github actions

enter image description here

Run scp  -o StrictHostKeyChecking=no -r ./.env ./docker-compose.prod.yml root@***:/app
  scp  -o StrictHostKeyChecking=no -r ./.env ./docker-compose.prod.yml root@***:/app
  ssh -o StrictHostKeyChecking=no root@*** << 'ENDSSH'
    cd /app
    source .env
    docker login ghcr.io -u $NAMESPACE -p $PERSONAL_ACCESS_TOKEN
    docker pull $WEB_IMAGE
    docker pull $NGINX_IMAGE
    docker-compose -f docker-compose.prod.yml up -d
  ENDSSH
  shell: /usr/bin/bash -e {0}
  env:
    WEB_IMAGE: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')/web
    NGINX_IMAGE: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')/nginx
    SSH_AUTH_SOCK: /tmp/ssh_agent.sock
Warning: Permanently added '***' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
root@***: Permission denied (publickey,password).
lost connection
Error: Process completed with exit code 1.

Here is my /etc/ssh/sshd_config on the docker droplet on digital ocean

PermitRootLogin yes
PasswordAuthentication yes
PubkeyAuthentication yes
ChallengeResponseAuthentication no
UseLogin yes
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp  /usr/lib/openssh/sftp-server

and restarted

sudo systemctl reload sshd
sudo service ssh restart

Please let me know if you need more files or folders or information

1 Answers

Try the following:

cat ~/.ssh/id_rsa.pub

and copy the public key to

nano ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/id_rsa
Related