GitHub automated backup

This helped me a lot.

When you SSH into HA you’re actually ssh’ing into an add-on which is a different docker container from HA itself. Each docker container has its own filesystem and installed packages, successfully running it while ssh’ed really doesn’t tell you anything about whether it will work when run from HA.

all above was right, but I had to open a console of HA execute the following command (thanks @VDRainer!):

docker exec -it homeassistant bash

then run the shell script (which was already working in the regular terminal)

bash /config/ha_gitpush.sh

the system then asks me to put github.com to the list of konwn hosts.
After that, the shell script worked again, while starting to a HA-automation.

But it wasn’t resistant because of:

Normally you just go through this once and then you are good to go, it never prompts you to verify authenticity again. However with HA this is another gotcha. The problem is that by default the known_hosts file is stored in /root/.ssh . Which means if you stop here your sensor will appear to work but will break next update when /root is wiped clean.

in order to set the proposed ssh option -o UserKnownHostsFile=... to git. I used this command:

git config core.sshCommand 'ssh -o UserKnownHostsFile=/config/.ssh/known_hosts -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa -F /dev/null'
5 Likes