Github action use SSH to access remote host and execute a script
In this article, we will use 6 steps to illustrate how to use Github action to access a remote server and execute the shell script. So that’s getting started:
step 1. Generate keygen in local machine
In your local machine, execute the following command in the terminal and generate your ssh-keygen.
ssh-keygen -f ~/.ssh/yourhost -t ed25519 -b 4096 -C "youremail@example.com"
step 2. Copy our public key to the remote server’s authorize
# goto remote server
echo "your public keygen content" >> .ssh/authorized_keys
step 3. copy our Private Key and paste it into Github Secrets.
Go to “Settings” > “Secrets”, and click “New repository secret” button.
Continue Reading