Special Offers: Up to 75% OFF on Hostinger & High-RAM Contabo Cloud VPS available this month.Compare Plans

How to Automate VPS Deployments with GitHub Actions and SSH Keys (Zero Downtime)

Alex Vance
Alex VanceCloud Infrastructure Architect
October 22, 2026
•
15 min read
•
4.9 / 5.0
Transparency Notice: This article contains affiliate links to hosting providers like Hostinger and Contabo. If you purchase through our links, we may earn a commission at zero extra cost to you. We only recommend products we personally benchmark and test. Read full disclosure.
How to Automate VPS Deployments with GitHub Actions and SSH Keys (Zero Downtime)

Hostinger vs. Contabo: Full Specifications Breakdown

Data verified from our lab benchmarks • Updated for 2026

Feature / Metric
HostingerEditor's Choice UI
ContaboMax RAM Value
Starting Price$2.99 / month (Web) | $4.99 / mo (VPS)$5.50 / month (Cloud VPS S)
vCPU Cores1 to 8 vCPU (Dedicated resources)4 to 12 vCPU (High Core Count)
RAM Memory4 GB to 32 GB6 GB to 64 GB (Gigantic RAM)
Storage Technology50 GB – 400 GB NVMe SSD50 GB NVMe or 300 GB SSD
Traffic / Bandwidth4 TB to 32 TB32 TB Outgoing + Unlimited In
Control Panel & UIhPanel (Ultra Modern & Easy)cPanel, Plesk, Webmin, or CLI
Customer Support24/7 Live Chat & AI Support (Multi-lingual)Email Ticket Support (German Business Hours)
Best ForBloggers, WordPress Sites & Devs wanting easy UIHeavy Database, Docker, Game Servers & SysAdmins
Money-Back Guarantee30-Day Money-Back Guarantee14-Day EU Statutory Cancellation
Official LinksVisit HostingerVisit Contabo

The Shift from Manual Deployments to Automated CI/CD

Manually connecting to your cloud VPS via SSH, running git pull, rebuilding assets, and restarting PM2 or Docker is slow and error-prone. With GitHub Actions, you can automate your entire deployment workflow: every push to the main branch triggers automated linting, test suites, and remote production deployments with zero human intervention.

Step 1: Generating a Dedicated Deployment SSH Key

On your local computer, create a keypair specifically for GitHub Actions:

ssh-keygen -t ed25519 -C "github-actions-deploy" -f ~/.ssh/github_deploy_key

Copy the public key to your remote VPS user's ~/.ssh/authorized_keys:

ssh-copy-id -i ~/.ssh/github_deploy_key.pub deployer@YOUR_VPS_IP

Step 2: Storing Secrets in Your GitHub Repository

  1. Navigate to your GitHub repository -> Settings -> Secrets and variables -> Actions.
  2. Click New repository secret and add the following:
  • HOST: Your server public IP address.
  • USERNAME: Your non-root sudo username (e.g. deployer).
  • SSH_KEY: The private key contents of ~/.ssh/github_deploy_key.
  • PORT: Your SSH port (e.g. 22 or custom port).

Step 3: Creating the GitHub Actions Workflow File

In your local codebase, create .github/workflows/deploy.yml:

name: Production Deployment

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Deploy to VPS via SSH
        uses: appleboy/ssh-action@v1.0.3
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          key: ${{ secrets.SSH_KEY }}
          port: ${{ secrets.PORT }}
          script: |
            cd /var/www/my-production-app
            git pull origin main
            npm ci --omit=dev
            npm run build
            pm2 reload ecosystem.config.js --update-env

Step 4: Committing and Testing the Automation

Commit your workflow file and push to GitHub:

git add .github/workflows/deploy.yml
git commit -m "ci: add automated production deployment workflow"
git push origin main

Navigate to the Actions tab on GitHub to watch your deployment run and verify your live website updates seamlessly.

Editorial Verdict: Pros & Cons

What We Love (Pros)

  • Eliminates manual SSH logins and repetitive terminal commands
  • Ensures automated test suites pass before deploying code to production
  • Roll back bad deployments instantaneously via Git commit hashes

Drawbacks (Cons)

  • Requires careful handling of private SSH keys in GitHub Repository Secrets
#GitHub Actions#CI/CD#Automated Deployment#DevOps#VPS
Alex Vance

Written by Alex Vance

Cloud Infrastructure Architect

Alex and the ServerCraft engineering lab run routine benchmarks on over 25 web hosting providers, maintaining strict objectivity and reproducibility.

Recommended Next Reads