last_updated: 2026-11-24

git push deploy#

I am trying to find the simplest way to deploy stuff on a remote with pyinfra and ssh while keeping a history of config changes in a separate git repo.

Each deployment lives in a git repo, e.g. root@enterprise:/opt/zitadel. The deployment owns its config (mise), secrets (fnox) and setup (docker compose).

To edit a deployment on locutus, I simply do

cd ~/deploy/zitadel
git push

For that to work, the repo has to fulfil a contract:

  • there MUST BE an up script in the repo root

  • there MAY BE a pre-flight script in the repo root

That’s almost it.

For git push to execute those scripts [^hooks], the repo must be configured on the remote. That is where pyinfra comes in. It does the following steps:

  • init the repo /opt/zitadel on enterprise as root

  • register generic scripts as git hook that run

    • the pre-flight script in git’s pre-receive hook (optionally)

    • the up script in the post-receive

TODO: some code examples here. If you are interested, hit me up on The Matrix.