ConfigMgr

VMware, Azure and Automation

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

Recent Posts

  • Using API for Aria OPS Chargeback
  • Unable to set reservation on Org VDC
  • Veeam Tweaks
  • VCF Anyone? Get your license for free…
  • Configure Entra ID as Cloud Director IdP

Recent Comments

Geen reacties om te tonen.

Archives

  • april 2025
  • maart 2025
  • november 2024
  • oktober 2024
  • januari 2024
  • november 2023
  • oktober 2023
  • september 2023
  • juni 2023
  • mei 2023
  • april 2023
  • november 2022
  • maart 2021
  • februari 2021
  • januari 2021
  • november 2020
  • oktober 2020
  • september 2020
  • juli 2020
  • juni 2020
  • april 2020
  • maart 2020
  • februari 2020
  • oktober 2019
  • september 2019
  • juli 2019
  • juni 2019
  • mei 2019
  • maart 2019
  • februari 2019
  • januari 2019
  • december 2018
  • november 2018
  • april 2018
  • januari 2018
  • juli 2017
  • juni 2017
  • mei 2017

Categories

  • AnyLinq
  • Azure
  • Cloud Director
  • ConfigMgr
  • DIY
  • HomeAssistant
  • Microsoft
  • PowerCli
  • Powershell
  • SCCM
  • Script
  • Solutions
  • System Center
  • Veeam
  • VMware
  • vRealize Automation
  • vRealize Orchestrator
Proudly powered by WordPress | Theme: Doo by ThemeVS.