Trying to get this add on to work, but received to following the log
Check SSH connection
[Warn] No valid SSH connection for [email protected]
[Info] Start adding SSH key
[Info] Setup deployment_key on id_rsa
[Info] setting up credential.helper for user: scott_suine
[Info] Saving git credentials to /tmp/git-credentials
fatal: could not read Username: No such device or address
[Info] Local git repository exists
[Info] Git origin is correctly set to [email protected]:ne/hassio.git
[Info] Start git fetch...
Warning: Permanently added the RSA host key for IP address '18.205.93.0' to the list of known hosts.
Load key "/root/.ssh/id_rsa": invalid format
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
[Error] Git fetch failed
I have a repo in my config directory which sucessfully pulls from the remote repository ( bitbucket) if I type git pull inthe cli, so I know SSH keys are set up correctly
Iām using it on bitbucket without issue, however Iām not using an SSH key, Iāve put in my username and password in the config and it does a āgit pullā OK
Took a backup of the /config/ directory by creating a tarball
exited ssh and downloaded my tarball using scp
Installed and configured the git pull addon using a config similar to (could not get the rsa key to work, only a username/password [used a personal access token]):
Did a comparison of my downloaded tarball files and the /config/ directory now that git pull addon is enabled
Copied all the missing files from my prior backup of that directory into /config/. Things like zwave config files and home-assistant database file
Once everything was all matched up I rebooted hass.io from the UI and everything is good
The thing that was difficult for me to grasp and understand was that the addon completely wipes out everything prior to install, including zwave config, discovered components, and all the automagically created stuff that is stored in other config and database. Once I realized that I was able to circumvent the issue by copying over all the files that initial process creates.
I want to use this addon in the following workflow:
Make changes to the local files using Atom and the samba addon
Push the changes to github for backup and travis-ci testing
Let the āGit Pullā addon pull the tested changes back and restart hass.
Unfortunately, I canāt get āgit pullā to run properly. I suspect for two reasons:
1 The github remote is not āoriginā, itās āgithubā (I use origin for a local gitosis git server)
2 I use the git protocol to access github and not https://
I get an error when I run this
[Error] git origin does not match git://[email protected]:garethhowell/Home-Assistant-Configuration.git!
I do specify that
"git_remote": "github",
but I wonder if this is being ignored because itās always been used with
I also did have problems configuring the add-on at first. Copying the example config and go from there helped me. I think it was the mandatory .git ending. Btw, this restrictions does not make sense since .git is not necessary if you create a bare repository and access it via ssh.
I successfully installed the plugin and initiated it. This is very powerfull. However I have encountered a bug. The plugin stop accepting the rsa key after few hours :
Check SSH connection
[Warn] No valid SSH connection for ssh
[Info] Start adding SSH key
[Info] Setup deployment_key on id_rsa
[Info] Local git repository exists
[Info] Git origin is correctly set to ssh://[email protected]:2222/home-assistant/home-flamel.git
[Info] Start git fetch...
Load key "/root/.ssh/id_rsa": invalid format
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
[Error] Git fetch failed
I need to restart the plugin to get it back to work:
Check SSH connection
[Warn] No valid SSH connection for ssh
[Info] Start adding SSH key
[Info] Setup deployment_key on id_rsa
[Info] Local git repository exists
[Info] Git origin is correctly set to ssh://[email protected]:2222/home-assistant/home-flamel.git
[Info] Start git fetch...
Warning: Permanently added '[git.afola.ovh]:2222,[52.49.89.82]:2222' (ECDSA) to the list of known hosts.
[Info] Staying on currently checked out branch: master...
[Info] Start git pull...
Already up to date.
[Info] Checking if something has changed...
[Info] Nothing has changed.
Agreed ā I do a pre-check in a Jenkins container, then commit to master; in past workflow (hass, icinga/nagios) Iāve pushed to a remote repos that acts immediately to validate and update, but sits idle without polling in the meantime.
I would want to re-use code, and I do have a PR out for a deploy_key error in git_pull, it might be worth extending to make it accept pushes? Or would that cloud the intention of git_pull too much ?
It does work, but Iāve found .gitignore regex syntax throws me off because itās ever so slightly different from bash syntax for some things. I donāt recall where I got this but it was specifically recommended for use with this addon:
# Example .gitignore file for your config dir.
# An * ensures that everything will be ignored.
*
# You can whitelist files/folders with !, these will not be ignored.
!*.yaml
!.gitignore
!*.md
!esphome/
!themes/
!light_profiles.csv
!*.h
# Ignore folders.
.storage
.cloud
.google.token
# Ensure these YAML files are ignored, otherwise your secret data/credentials will leak.
ip_bans.yaml
secrets.yaml
known_devices.yaml
This approach ignores everything by default, so itās a conservative approach and works by making exceptions for what you want to track.
I think thereās a bug using an RSA key thatās generated with the ed25519 protocol even though the deployment_key_protocol accepts that format. I had to generate one with the legacy rsa format based on githubās instructions in /root/.ssh/
specifically:
I then had to copy the contents of the id_rsa into the Git Pull deployment_key
Also I had to use the Terminal & SSH component and in the /config folder I ran
git init.
In my case, I had already copied the specific files I wanted to track/update into my git repo and at that point wanted to stash any local changes I had made on my pi, so I ran the following:
git add .
git stash
At this point I could start the Git Pull component using the following configuration in the add on:
providing a username + password, or username + security key didnāt work for me.
Also, the repository had to be in an ssh format instead of an https format.
Has anyone figured out how to prevent git pull from initially wiping the PI? I have multiple devices and Iāve set them up to pull the same automation and scripts, but they each need their own cloud config and other settings, so I canāt back up the entire PI in the Git Repo. This plugin works great after the initial wipe, but because of the initial data loss I canāt set it up on more devices.
Any ideas on how to prevent the initial wipe would be amazing! Thanks
Is it possible to specify a file name pattern in the restart_ignore list? For example, I want to exclude any files ending with .sample or .md from triggering a restart?
I tried:
restart_ignore:
- *.md
but get an invalid yaml error and it wonāt let me save the config.
I am trying to set this up, but struggling to get it to use my ssh key. It is not at all clear how to define the key. There is a field in the config that allows entry of the key, but copying and pasting it from the id_rsa field into the field doesnāt seem to work. Looking at the docs, it seems there may have been an odd format for adding this into the YAML config, and this is made more confusing by the switch to GUI config and no way to see the underlying YAML [that I can figure out].
I get the following error message in logs:
[Info] Start git fetch...
Load key "/root/.ssh/id_rsa": invalid format
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I am successfully using the same SSH key with the File Editor add-on, so I know the problem isnāt with the key or the repository. I do recall that the File Editor add-on couldnāt read the ssh key from /root/.ssh - I had to copy it to /config/.ssh. However, this Git Pull add-on requires manual entry of the whole key, so I am confused as to why it refers to an id_rsa file.
Has anyone got this working using the current config method?
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.