DevOpsDevOps

How to Set a Deploy Branch in Dokku Other Than `main`

Jul 01, 2025 · by Tim Kamanin

I like using Dokku for single-server deployments. It's a small and very stable self-hosted PaaS that's been around for ages.

One of my favorite Dokku features is Git deployment. By default, you can push the main branch to the server, and Dokku will automatically deploy it. However, sometimes I don't want to push the main branch - instead, I want to push a stg branch for my staging environment.

Luckily, there's a simple way to change the deploy branch in Dokku. Just use the following command while logged into your server:

dokku git:set <my-app-name> deploy-branch <my-branch-name>

For example:

dokku git:set blog deploy-branch stg

Now you can push your stg branch to the Dokku origin, and it will deploy from stg instead of main:

git push dokku stg

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates