How to deploy with a simple git push
Updated 10/16/2026
The most pleasant deploy flow: you write code, run git push, and the server updates itself. Here is how to build it with a Git hook.
1. Create a bare repo on the server
mkdir -p /var/repo/site.git
cd /var/repo/site.git
git init --bare
2. Add a post-receive hook
Create /var/repo/site.git/hooks/post-receive:
#!/bin/bash
git --work-tree=/var/www/site --git-dir=/var/repo/site.git checkout -f main
cd /var/www/site
# build commands, for example:
composer install --no-dev
php artisan migrate --force
chmod +x /var/repo/site.git/hooks/post-receive
3. Add the server as a local remote
git remote add production root@SERVER_IP:/var/repo/site.git
git push production main
On every push, the hook checks the code out into the web directory and runs the build commands.
For more complex flows
When you need tests and multiple steps, move to a CI/CD pipeline. For visual deploys, see the Coolify app.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to send WhatsApp messages from your apps with OpenWA
OpenWA gives you a REST API over WhatsApp, on your own server. Here is how to install it, connect it and send your first message, safely.
Updated 10/16/2026Dev environmentsHow to deploy an app from Git with Openship
From a Git repo to a live app, with a database, domain and SSL, on your own server, with no config files.
Updated 10/16/2026Dev environmentsHow to set up Python virtual environments
Isolate each Python project dependencies with virtual environments, so they do not clash.
Updated 10/16/2026