Home > Mobile >  SSH into Google Compute Engine VM as a GitHub Actions bot
SSH into Google Compute Engine VM as a GitHub Actions bot

Time:11-18

When I created my VM on Compute Engine, it created a user user. I can SSH into my VM from my command line by:

ssh [email protected]

My Linux VM has another user called botuser that will be used by GitHub Actions to perform a git pull in a target directory.

I am trying to create the GitHub actions for this. But I am unable to even connect as this user from my own command line:

ssh [email protected]

I get the error Permission denied (publickey). I know I will need to set up SSH for this bot to log in to my VM with GitHub Actions and provide a private key somewhere to GitHub Secrets, but I'm not sure on the specific steps. The SSH for my default user was set up during the course of deploying my VM from Google Compute Engine on GCP.

How can I grant GitHub Actions the ability to SSH in to a Compute Engine VM as the pre-existing Linux user botuser?

CodePudding user response:

  1. Try to generate a public and private key.
  2. Load the public and private key inside ur CI ,put them as a secrets and establish them inside ~/.ssh/.
  3. Add ur public key inside the ~/.ssh/authorized_hosts .

after that u can access to ur address via ssh.

  • Related