I recently started to use HA. I bought the green box to run it.
Before really diving in, I want to setup GIT so that my configuration gets version control.
I run my own git server for my local projects.
I am unable to get GIT on HA to authenticate.
created a new repository in ssh://home.local/git/HAConfig.git
initialised GIT in my /homeassistant/config/ folder
added the address in (1) as the remote origin
copied my keys to /homeassistant/config/certs/
configured GIT with my user.name
Attempting to do a git push from the action (…) menu I find that permissions are denied.
Attempting to push from the Terminal shows that is is asking for the password for [email protected] - instead of my username.
I assume root is the current user on the green box??
Any suggestions for a work around please?
EDIT: BTW, you could use the certificate generated with ssh-keygen on your own server, if you add the generated public key to your ~/.ssh/authorized_keys
Now, that’s git / ssh 101, not much to do with HA itself tbh
One of the steps in the guide that I pointed out above, is to configure GIT with the non-standard location for keys.
Searching for solutions, I saw people using config/certs and config/.ssh … neither of which would have worked without extra configuration I believe.
You can use any location under /config.
That’s one of the few directories that are common across all addons.
Addons are independent docker containers, if you were not aware.
Note also that that git configuration is independent of github: it works the same way for any git “server” if you do what I told about authorized_keys, above.
I use GIT for all my HA config. I do it a bit differently. I do all my config in YAML and don’t use the HA editors. FWIW this is what I do.
On my laptop I have a directory call ha_config, that is attached to a private GitHub repo
I use vscode to edit the files in there
When I’ve completed a change, I then use git to review the changes and make sure everything looks right (aka a code review), if it does then
I have a shell command ha-compare that does a diff between ha_config and the running HA system. This allows verification of what is actually different.
I then run ha-deploy which transfers the files to the ha system
I then run ha-check which issues a REST API command to ask HA to validate the config
I then run ha-restart which issues a REST API command to restart HA
8, If the changes work then I com it to git,
Periodically via another command I’ll copy the running ha back to the laptop and check in changes to .storage
That’s the simplified version. I have two HA systems for difffent houses. Since I want stuff consistent. I create my own object / class definitions (automations, template, UI) in a separate git repo and run scripts that build the config into those ha specific repos. That’s just an extra layer.