• About me…
  • VMware
  • Powershell
  • DIY

ConfigMgr.nl

VMware, PowerShell, Automation, and more…

  • About me…
  • VMware
  • Powershell
  • DIY

Copying Home Assistant configuration to GitHub

14 november 2022 DIY HomeAssistant

After some issues with my Home Assistant setup, I looked at ways to save my configuration files to GitHub. I found a very detailed Youtube video that showed how to do it: https://www.youtube.com/watch?v=hhv-WqGUy_o

However, in the end, the automated solution used an option I did not want to use: “StrictHostKeyChecking=no“. This option means that you disable host verification. For me, this is a bad security practice.

So what did I do?

First I configured the local repository and the connection to GitHub:
– Create a GitHub repository.
– Create a .gitignore file in the Home Assistant config folder.
– Create an SSH private/public key and copy the public key to GitHub.
– Create the local Git repository (git init).
– Add files to the repository (git add .)
– Commit the changes (git commit -m "First Upload").
– Add a new remote to the repository (git remote add origin git@github.com:jeroenburen/homeassistant).
– Configured GitHub sshCommand (git config core.sshCommand 'ssh -i /config/.ssh/id_rsa -F /dev/null').
– Copy the files to GitHub (git push -u origin master)

This works fine and when you make the connection to GitHub for the first time it will ask you if you trust the remote server. When you do it will create a file known_hosts and inside that file is the server with its public key.

But when you want to automate this and you create a script file you will get an error when you run the script. This error is also shown in the video. The solution in the video is to change the GitHub sshCommand to include the “StrictHostKeyChecking=no” option.

I think this option was used because it can be very tricky to use the known_hosts file. The reason for this is that the Terminal Add-On is a separate Docker container with its own root folder. So the root folder is NOT shared between containers. However, the config folder is shared so when you reference this folder it should work. I got this information from this article: https://community.home-assistant.io/t/sshing-from-a-command-line-sensor-or-shell-command/258731

In the end I used this command to get it to use the known_hosts file: git config core.sshCommand 'ssh -o UserKnownHostsFile=/config/.ssh/known_hosts -i /config/.ssh/id_rsa -F /dev/null‘

The system has insufficient locker space for the image profile

Reset your Windows password in 5 minutes

Recente berichten
  • VCDA – Operation canceled
  • VxRail Console Commands
  • VxRail Cluster Health Monitoring disabled
  • Handy one-liners
  • Deploying Patches to VCF – RTFM
Categorieën
Proudly powered by WordPress | Theme: Doo by ThemeVS.