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 "[email protected]". 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.



Alright ! I found the solution myself but got an issue, the shell_command.backup service was not found despite the reload of my whole configuration. I had to restart home assistant.
I will wait to see if the automation runs great !
Public or private repository ?
I wonder if any secrets could get exposed or if I'm safe making the repo public ?
Other configuration outside /config
What about the directory at /root/addon_configs, /root/addons ?
My exemple is sponsorblockcast at /root/addon_configs/db21ed8f_sponsorblockcast/config.yaml
Home assistant v2 db being big
The file home-assistant_v2.db is at 46MB. Should I enable LFS right now ? Should I ignore the .db file ?
Thank you for your gist, really easy to configure everything.
Maybe you also forgot to use
git initandgit add remoteto your steps :)