Git & deploy·2 min read

Deploy automatically after every git push (webhook)

Let your website update itself after every push to GitHub. Set up the webhook in two minutes, and learn what does and doesn't happen automatically.

Have you connected a repository? Then your website can update itself after every push. No button, no FTP. In our own test a change was live within 3 seconds of git push.

How do you set up the webhook?

  1. In Invoker Link, open the GitHub tab and click Update automatically next to your repository.
  2. Copy the Payload URL.
  3. Click Open GitHub. You land on Settings → Webhooks → Add webhook.
  4. Fill in:
    • Payload URL: the copied URL
    • Content type: application/json
    • Which events: Just the push event
  5. Click Add webhook.

GitHub immediately sends a test message ("ping"). Under Recent Deliveries it should show a green tick.

Testing

git commit -am "Test: automatic deploy"
git push

Refresh your website. The change is there within seconds.

What exactly does the webhook do?

On every push:

  1. the server fetches the latest commits,
  2. it places the files of the chosen branch in the chosen location.

If you push to a different branch than the connected one, nothing changes on your website.

Good to know

  • Files you delete from the repository stay on the website. A deploy only writes what's in the repository. Clean up old files yourself.
  • Treat the webhook URL like a password. Anyone who knows the URL can trigger a deploy. That only publishes what's already in your repository, but don't share the URL.
  • Changes made on the server are lost at the next deploy. If you edit a deployed file directly on the server (via FTP or the assistant), the next push overwrites it. Work in the repository.

Not working?

Look in GitHub under Settings → Webhooks → Recent Deliveries:

What you see What it means
No deliveries The webhook isn't set to the push event, or nothing has been pushed yet.
Red cross, 404 The URL wasn't copied correctly, or the connection was removed.
Green tick, site not updated You pushed to a different branch than the connected one.
MK
Maarten Keizer

Founder of Invoker. Over twenty years in hosting, system administration and web development; builds the Claude hosting himself and tests everything on our own servers first.

about maarten