Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Before we take a look at the actual GitHub action we’re going to generate an SSH key:

Code Block
languagebash
ssh-keygen -m PEM -t rsa -b 4096 -C "you@your_mail.tld"


Our SSH key is required to be in PEM format, hence the -m PEM flag.

...

We’ll do so using ssh-copy-id:

Code Block
languagebash
ssh-copy-id -i /path/to/your/key youruser@yourhost


This will copy the 
public key of your key pair to the remote host and add it to its list of authorized_keys.

Or if you are already on on the server via terminal, you just append the new public key to the authorized_keys file.

Code Block
languagebash
ssh-copy-id -i /path/to/your/key youruser@yourhostcat <your_public_key_file> >> ~/.ssh/authorized_keys


Info

Note the double > without the double > the existing contents of authorized_keys will be over-written (nuked!) and that may not be desirable



https://dev.to/s1hofmann/github-actions-ssh-deploy-setup-l7h

...