Woman focused on laptop with colorful GitHub-themed stickers, eyeglasses in foreground.

Connecting a GitHub Private Repo to Hostinger with Auto-Update Commits

Woman focused on laptop with colorful GitHub-themed stickers, eyeglasses in foreground.
Photo by Christina Morillo on Pexels. Source.

For developers looking to streamline their deployment process, connecting a private GitHub repository to Hostinger can replace traditional Netlify integrations, ensuring your code updates are automatically deployed. This guide walks you through a secure setup using SSH keys.

Prerequisites

  • Hostinger account with SSH access enabled.
  • A private repository on GitHub.
  • Basic knowledge of SSH and Git operations.

Setup Hostinger for Git Access

First, generate an SSH key pair on your local machine. Open your terminal and execute:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Copy the public key to Hostinger. Navigate to the SSH keys section in your Hostinger control panel and add your key for the specified domain.

Add SSH Key to GitHub

On GitHub, access your repository’s settings and add the SSH public key. Ensure you give it proper access permissions needed for deployment.

Connect GitHub Repo to Hostinger

From your Hostinger SSH terminal, clone the repository:

git clone [email protected]:username/repo.git

Add Hostinger as a remote repository if necessary:

git remote add hostinger ssh://[email protected]/~/repo.git

Verify Deployment

Push commits to GitHub and test automatic deployment:

  • Check files are up-to-date on Hostinger.
  • Run deployment scripts manually if required.

Troubleshooting Tips

  • Ensure SSH keys are correctly installed and accessible.
  • Verify GitHub permissions for SSH keys.
  • Check server logs for connection errors.

Sources

For a detailed discussion, see this Reddit thread.

Transparency Note: This article was drafted with AI assistance, ensuring factual guidance through automated source verification.