For this article, we will use the IP address 192.158.1.38 as an example.
To access your server, use the SSH command with your server's IP address.
If everything is set up correctly, you should see output similar to the screenshot below.
Open your IP address in a browser to verify the installation. You should see the "Welcome to Nginx" page.
Example: http://192.158.1.38/
When prompted, enter the file name to save the key (/root/.ssh/id_rsa
), and then enter and confirm a passphrase. For CI/CD pipelines, it is common to leave the passphrase empty, though this is not the most secure option. I will update this guide in the future with more secure practices.
You should see a list of files in the .ssh
directory similar to the following screenshot.
To view the public key, use the following command:
www.example.com.pub
) into the provided field.Back in your VPS terminal, display the contents of the private key:
Go to GitHub → (your repository) → Settings → Secrets and Variables → Actions → New Repository Secret. Create a new secret called SSH_SECRET_KEY
(or name it according to your preference), and paste the contents of the private key (www.example.com
) as the value.
Back to the VPS terminal, append the public key to the authorized_keys
file:
authorized_keys
If necessary, you can edit the authorized_keys file to remove any keys you don't recognize or if you added any key more than once:
After making your changes, press Ctrl + S
to save and Ctrl + X
to exit the editor.