As always, please CONSTANTLY read and UNDERSTAND what you copy and run on the Internet. Stay safe!
- mkdir a
.ssh
dir to the root of the config folder (should be/root/homeassistant
) ssh-keygen
to 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.pub
content to yourSettings
➜Deploy keys
page of your Github repo - Because the shell command won't (obviously) have access to all of the HA instance,
cd
to your ha configuration directory and run that command to target the newly generatedid_rsa
file:
git config core.sshCommand "ssh -i /config/.ssh/id_rsa -o 'StrictHostKeyChecking=no' -F /dev/null"
- Copy
backup.sh
to the HA configuration folder - Create a
.gitignore
file 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.yaml
and 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 nativenotify
service.
I have this issue with the automation only, "Identify file /config/.ssh/id_rsa not accessible : no such file or directory."
Is this due to the permissions ?