简体   繁体   中英

SSH into Google Compute Engine VM as a GitHub Actions bot

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 user@vm.ip.address

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 botuser@vm.ip.address

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 ?

  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM