Ok - I’ll answered my own question.
Use the … menu at the top of the configuration page to select Edit in YAML.
If you already pasted in a long SSH key, then you will need to scroll right to see the … menu!
That’s why I missed it.
Put the
--- BEGIN OPENSSH PRIVATE KEY ---
line in single quotes.
Put the key itself into it’s own line using
>-
to make it multiline. The relevant part of the config looks something like this:
Put the
--- END OPENSSH PRIVATE KEY ---
line in single quotes, and on a new line.
Never would I ever have thought to try that, but it worked just fine. I wish I just drop my ssh key into my home directory and be done with it.
Hey there folks, just set this up myself.
IMO the safest way to get started with this add on is to make the config folder a git repo via the SSH addon BEFORE starting this add on. So do git init, git pull, configure the git repo as you want it first to make sure everything is working. After
git rev-parse --is-inside-work-tree
returns
true
in the
/config
folder (this is what the addon runs to figure out if a repo already exists), you can add this addon.
Then, it won’t remove all the files in the config folder, it’ll just pull the existing git repo. It might be worthwhile to update the documentation for the addon to recommend this route, since the other route (initializing the git repo via the add on, which deletes everything first), is pretty risky/potentially destructive. See the code here that bypasses the “blow everything away” code if
/config
is already a git repo:
https://github.com/home-assistant/addons/blob/cd11be29f99ad544b76679b09a33cdf86291bbe2/git_pull/data/run.sh#L118
.
One other thing that’s been helpful in getting it set up – just ignoring all files to start by default, and having git own only the directories/files you want under version control. Then you don’t have to worry about git tracking the DB, any other files that show up, etc. For example, here I’m only tracking
.gitignore
and the
custom_components
directory in my repo, but all the other config files in the
config/
folder aren’t touched:
!.gitignore
!custom_components/
!custom_components/**
New changes were made for addon configs:
Public Addon Config | Home Assistant Developer Docs
Anyone figured out how to include
/addon_configs
which previously stored in
/config
(now
/homeassistant
) and also included in the git repo?
I’m also stuck with that (using AppDaemon). I’d like to keep using this add-on but I’d also like to have my AppDaemon stuff synced using Git now that it’s in a different folder away from my usual repository…
I guess you could write a custom script for the git pulls but the add-on is so convenient
it is a bit surprising to me that this addon is not written in a way to preserve the config files in cases where they don’t exist on a remote repository at initial setup.
like, would it be so difficult to either initiate a backup or just copy the directory to a new .git-pull-backup directory on first run?
i am really surprised that something so destructive is available without a major warning somewhere in the process (and on the official repo too)
Actually, it does make the backup — see
run.sh line 48
. But the, on any error, it just exits instead of restoring the backup (
line 55
).
It also is
broken in current versions of Home Assistant
.