Home Assistant… you git.

See what I did there? #dadjoke (I know, I’ll show myself out).

Seriously though, with the amount of time and effort I have put in so far (and will continue to put in), I thought it was time to give myself a little bit of a backup of my HomeAssistant config. Looking around, github seemed the best option.

Sure, there are issues with this option. I can’t backup passwords to it, or API keys – but I have a few systems for those, that are also passworded.
I have to manually update it when I make changes.

Why’s that crossed out? Because yes, I do – but that’s not an issue. In fact, version control is the whole point of this.
If I make a change that breaks something, I simply revert to the previous commit. I can make a branch to test something, risk free – and remove it later on, safely.

So where is it? Well, here. It’s running.
I created the repo on github, initialised the repo in the config folder, added a ‘remote’ url, and pushed my existing config up to my repo.
Yes, I had to specify a .gitignore file – so that any text-to-speech snippets didn’t upload, no passwords, device histories, geolocations, etc – but that’s fine. Those are all things that I can recreate from my secure storage, with my notes. And I’m working on keeping better code notes, because it’s getting ridiculous.

Best part? I can use a nice editor on any machine I like, make the changes, and push them to the repo. Then, I can run my update-hass script via ssh, which does a git pull and a hass restart. Awesome.

Eventually, maybe, I’ll automate that part – maybe a button inside hass to run a shell command for git pull? We will have to see.

Permanent link to this article: https://www.berserkir.net/wordpress/home-assistant-you-git/