How to keep private ssh key across restarts for git

I want to keep my configuration in git. I made the /config folder a repository and created a keypair to auth into github. The problem is that the home folder seems to be only in RAM and so when I reboot my raspberry, the keypair is lost.

Is there an “official” way to keep my keypair across restarts? Even if I placed the keys into a “permanent” directory, I would have to create a /root/.ssh/config file describing where the keys are (and that would have to be recreated after restarts). I am looking for a solution that would just work.

Off-topic related question to saving configuration in git - is it not possible to have folders as symlinks? E.g. /config, /data etc. If I create a symlink in their place (so that I can have all the settings in one git repo), home assistant fails to start because it apparently cannot read the config file from there.

Hassio runs on docker.

Docker containers are disposable. Data you want to keep needs to be mapped into the host.

Store your ssh key in config directory, and exclude it from git repo

1 Like