Using a GitHub Repository to deploy to Balena

Hi, I’m trying to set up my Balena and have hit a slight issue. I can’t find any documentation on how to connect my existing GitHub Repository to my Balena application. I can only see docs on how to deploy straight from my device to Balena.

I’m looking to add in the GitHub Repository so that I can access my program from any Development device and ensure that all versioning is correct.

The way I want this to work is:

Development device >>pushes >>GitHub Repo >> pushes automatically >> Balena

Is this possible?

Can anyone point me in the right direction?



The usual development cycle is:
write or clone code > push to device using balena-cli or git push > image is deployed on device

If you want the cycle you described you will need to connect GH with a CI tool that will push the code to your devices.

Another approach is to host your code on github and from all your development machines, clone and keep the code in sync and push it to devices. For this you will need to have the ssh keys associated to your Balena account on every development machine.

Hi, yeah it’s similar to what you described for the usual method - I’m just wondering if there’s anyway I can do a git push from my github repository rather than the development device?

hi @GregorR1, you can definitely use a deployment step on a CI integration for pushing your changes to a balena remote. All you need to do, is a git push balena master step from the CI.
You can use some free CI services like CIrcleCI, TravisCI, etc for that.

Is it possible to pull from the balena? For example if we were to set up a new Development device, could we then pull a copy of the repo straight from the balena? Would this then remove the need for a seperate GitHub Repo altogether?

Hi @gregorr1 ,

Whilst you can clone from the git repository (for example git clone <user><user>/<application>.git), you absolutely should not. The reason is that these repositories are transient and essentially used as caches for our Builders. As such, there are no guarantees that the code in these repositories will not be removed as part of disk space cleanup. We state here that ‘Warning: The balenaCloud git repository is not intended as a code hosting solution, and we cannot guarantee the persistence of data in balenaCloud git remotes. We recommend you use a service like Github to manage and share your code.’.

You absolutely should use an alternative service as your main git repository, which is then used as the source for pushes to our git repositories. Moreover, I’d encourage you to remove the use of git push to our repositories completely and move to using the balena-cli balena push command. The use of git push is now considered deprecated, and we will not be adding any more functionality to it (whereas balena push has a wealth of remote and local development and build options).

Hope this helps!

Best regards,


Hi Heds,

I have decided to keep the GitHub repository seperate, and will push to the balena directly from my development device using Node-Red. I have created another thread regarding this, however, as I cannot get the connection between my Node-Red project and Balena to work.

Thanks for your detailed response, I will make sure to have a seperate GitHub Repo to manage my code.