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.
Not sure if you ever got this solved, but there is a way to do this. I thought Iād drop this response anyway, in case anyone is looking for an answer and finds this pageā¦
There a now a /config/ssh directory in which you can place all your ssh config files and pub/priv keys.
That folder is sym link mapped to the /root/ssh folderā¦
In there you can add your SSH config and public/private key pair filesā¦and it will get picked up by ssh, and in turn git, when you use an ssh style remote.
The āgitā link to my ha config repository on my home git server is: `ssh://[email protected]:10022/gil/ha.cancas.com.git``
so in my ssh config file (in /config/ssh/config) I have:
Host nas2.home
HostName nas2.home
User git
Port 10022
IdentityFile ~/.ssh/gilha
With my private key stored in /config/ssh/gilha and the matching public key registered on my home git server.
You can test it out by trying to just ssh to the remote address (e.g. for me that would be ssh nas2.home) to make sure that it works and that the remote host has been added to know_hosts file⦠and then try using git push/pull etcā¦