As always, please CONSTANTLY read and UNDERSTAND what you copy and run on the Internet. Stay safe!
- mkdir a
.sshdir to the root of the config folder (should be/root/homeassistant) ssh-keygento that directory. I've usedssh-keygen -t rsa -b 4096 -C "ha@home.local". I will not cover the usage of a passphrase here.- Copy
/root/homeassistant/.ssh/id_rsa.pubcontent to yourSettingsβDeploy keyspage of your Github repo - Because the shell command won't (obviously) have access to all of the HA instance,
cdto your ha configuration directory and run that command to target the newly generatedid_rsafile:
git config core.sshCommand "ssh -i /config/.ssh/id_rsa -o 'StrictHostKeyChecking=no' -F /dev/null"
- Copy
backup.shto the HA configuration folder - Create a
.gitignorefile into the HA configuration folder and add the needed exceptions (I've provided mine) - Copy the automation content (
automation.yaml), create a new automation and paste the content. You can also go to theautomations.yamland write it here if you're more comfortable. I've set the automation to automatically run at 2:00 am everday. Feel free to change it as you like. Also I like to be notified on the app, using the nativenotifyservice.



@vasilvestre I recommend you to commit the backups into a private repository, as even if you ignore things, some updates or new integrations may lead to exposing secrets, and you obviously don't want that. I often change my configuration, try new integrations and stuff, and I don't want to worry about that. It will be a peace of mind if you put everything into a private repository.
About the configurations that is outside the
/configfolder I'm not really sure how to handle that, since I don't have anything interesting located outside that folder. I may have other ideas to make the backup easier to configure and to save (everything, this time), which would involve Github release instead of committing, with the same idea of hass-auto-backup. In the meantime, feel free to improve my researches :)I've ignored the .db file since it's only historical data, mine is 404MB currently because of the recent devices I've added I guess, thus resulting into a failing commit because I didn't enabled LFS.
Actually here's my current
.gitignorefile: