Automatic deployment to Hostinger from GitHub

Published · 2 min read

Once a site lives in a GitHub repository, there is no reason to upload it by FTP. Hostinger has built-in Git deployment: the host pulls files from the repository, and a webhook triggers it after every change. Below is a setup that works both for plain sites and for sites that need a build step.

Option 1. Ready files in the repository

This suits repositories that already contain the files to put on the server (an HTML site, a WordPress theme and so on).

  1. In hPanel, open the website and its Git section (under the advanced settings).
  2. Enter the repository URL, the branch and the install directory — for the main site this is usually public_html.
  3. For a private repository, copy the SSH key Hostinger shows and add it to GitHub as a read-only deploy key.
  4. Deploy — the host pulls the files.
  5. Turn on auto deployment: Hostinger gives you a webhook URL. Add it in the GitHub repository settings (Settings → Webhooks) for the push event.

From now on every push to the selected branch updates the site.

Option 2. A site that has to be built

If the site is built by a generator (Next.js, Astro, Hugo and others), the server should receive the build output, not the source folder. A convenient setup:

  1. GitHub Actions builds the site on every push to the main branch.
  2. The build output is published to a separate branch, for example deploy.
  3. Hostinger's Git deployment points at the deploy branch.
  4. The last workflow step calls the Hostinger webhook so the site updates immediately.

Sources and built files never mix, and a rollback is simply moving the deploy branch back one commit.

Things to keep in mind

  • Secrets — keep the webhook URL and keys in GitHub Secrets, not in the code.
  • Files on the server that are not in the repository (for example user uploads) can be overwritten by Git deployment — keep them outside the deploy directory or in backups.
  • .htaccess with redirects and HTTPS rules is easiest to generate at build time and ship in the same branch.
  • Check after deploying: the home page, a couple of inner pages and a few old URLs that should redirect.

Together with an AI agent

This is the last link in managing a website with an AI agent: the agent makes changes locally, you approve them, a push to the repository — and a minute later the site is updated. That is how this site works too. A ready-made setup is part of agentic website management.

Need help with this?

New service

Agentic website management

Local machine → repository → server: you ask, an AI agent changes the site, every change is reviewed, saved and deployed automatically. I set it up and teach your team.

How it works →

More articles

Contact

Let's talk about your project

An AI agent, an automation, a website improvement or a full rebuild — describe the task in a few lines and I will reply within one business day.

Tallinn, Estonia · working remotely across Europe