GIT Pull Addon

I just noticed a new Addon in the built in repository - GIT Pull. The link to the website to see what all it does is not working. Whassup with this one?

2 Likes

I get the same, no info on it and reading the code I can’t figure out why it can’t clone.

Most Honored and Respected Gentlemen,

Is there any documentation to support this addon? I would really like to set it up on HASS.io however, it is not clear (to me) how to can authenticate with the repository.

Any assistance would be appreciated.

Muchas gracias de antemano.

Would like to know about this aswell

Looking over the code it looks pretty simple: Poll the configured repo every X seconds, git pull and restart if necessary.

https://github.com/home-assistant/hassio-addons/blob/master/git_pull/run.sh

This addon currently doesn’t work in hass.io as the config.json file is missing a mapping of the /config folder. So when it runs the container doesn’t see the /config folder and it tries to clone from the repo but the files don’t get mapped to the correct location.

Looks like that PR has since been merged, with the needed mapping: https://github.com/home-assistant/hassio-addons/pull/173/files#diff-72e4e8a08946c15ada9d5ad139be7b9bR10

Has anyone found out how to configure this plugin? When I run it, it just clears my config folder.

There is documentation now: https://home-assistant.io/addons/git_pull/

I am seeing the same problem though, the config directory being cleared out :sweat: I haven’t found any way to debug addons yet though, including just getting logs, or validating they are working.

Update: if you look at the addons page, there’s logs at the bottom. If you click ‘start’, it’ll try to start, then I get:

starting version 3.2.2
[Info] cleanup config folder and clone from repositorie
[Error] can't clone https://github.com/technicalpickles/picklehome-config.git into /config

There is a /config directory, so maybe it needs to be checked first, or there’s some other initial configuration to do?

Looking at the code for git pull it seems to be trying to remove stuff in /config, and then doing a new clone.

After installing git pull, the git executable is available, so I thought to try running this part manually through ssh (ie ssh [email protected]). I confirmed rm -rf /config/.[!.]* /config/* seemed to work, but the git clone "$REPOSITORY" /config failed:

core-ssh:~# git clone https://github.com/technicalpickles/picklehome-config.git
fatal: destination path 'picklehome-config' already exists and is not an empty directory.
core-ssh:~# ls /config/
home-assistant_v2.db

I think this means there’s a race condition, where homeassistant is trying to run, and creating the home-assistant_v2.db after we remove it. I was able to manually run the rm several times, and clone it down once.

I tried starting Git pull from http://hassio.local:8123/hassio/addon/core_git_pull but it was getting the same error. It seems the check for an existing git directory wasn’t working, so it was trying to remove everything.

I think ideally, homeassistant needs to not be running for some amount of time so /config can be cleaned out, and a new copy cloned down, so hass doesn’t keep trying to create a database file.

Do you find the solution?

Not yet, but making some progress. I was able to stop homeassistant, and git clone it in place manually. Here’s some quick steps:

  • configure the git pull addon: http://hassio.local:8123/hassio/addon/core_git_pull
  • configure the ssh addon if you haven’t already, and ssh in
  • run hassio homeassistant stop
  • run rm -rf /config/.[!.]* /config/* to remove existing config
  • run git clone https://github.com/technicalpickles/picklehome-config.git /config to clone it down
  • do any other prep you need (ie populate secrets.yaml)
  • run hassio homeassistant check to make sure it works

That is where I am stuck now. It seems permissions are wrong on /config:

core-ssh:~# hassio homeassistant check
Error on homeassistant/check: starting version 3.2.2
Testing configuration at /config
2017-10-08 20:33:11 ERROR (MainThread) [homeassistant.bootstrap] Unable to setup error log /config/home-assistant.log (access denied)
2017-10-08 20:33:11 INFO (SyncWorker_0) [homeassistant.config] Upgrading configuration directory from 0.7.7 to 0.55.0
Fatal error while loading config: [Errno 30] Read-only file system: '/config/deps'
Failed config
  General Errors:
    - [Errno 30] Read-only file system: '/config/deps'

I tried clearing everything out, and letting it auto-generate everything again. It’s owned by root, user read/writeable and everyone else can read. That is the same permission when I started with my config. Here’s what the auto-generated config permissions were:

core-ssh:~# ls -l /config/
total 72
-rw-r--r--    1 root     root             2 Oct  8 20:24 automations.yaml
-rw-r--r--    1 root     root          1718 Oct  8 20:24 configuration.yaml
-rw-r--r--    1 root     root             0 Oct  8 20:24 customize.yaml
drwxr-xr-x    2 root     root          4096 Oct  8 20:24 deps
-rw-r--r--    1 root     root             0 Oct  8 20:24 groups.yaml
-rw-r--r--    1 root     root           209 Oct  8 20:25 home-assistant.log
-rw-r--r--    1 root     root         49152 Oct  8 20:25 home-assistant_v2.db
-rw-r--r--    1 root     root             0 Oct  8 20:24 scripts.yaml
-rw-r--r--    1 root     root           157 Oct  8 20:24 secrets.yaml
drwxr-xr-x    2 root     root          4096 Oct  8 20:23 tts
core-ssh:~# ls -ld /config/
drwxr-xr-x    4 root     root          4096 Oct  8 20:25 /config/

And after trying to with my cloned configs:

core-ssh:/config# ls -l /config/
total 20
-rw-r--r--    1 root     root             2 Oct  8 20:26 automations.yaml
-rw-r--r--    1 root     root          1716 Oct  8 20:26 configuration.yaml
drwxr-xr-x    2 root     root          4096 Oct  8 20:27 deps
-rw-r--r--    1 root     root             0 Oct  8 20:26 groups.yaml
-rw-r--r--    1 root     root           239 Oct  8 20:27 home-assistant.log
-rw-r--r--    1 root     root           171 Oct  8 20:32 secrets.yaml
core-ssh:/config# ls -ld /config
drwxr-xr-x    4 root     root          4096 Oct  8 20:32 /config

https://github.com/home-assistant/hassio-addons is the repository for these addons, but issues are disabled so I’m not sure where things like this are supposed to be reported.

I can’t get the addon to actually sync with what is in my github. It appears to work, but nothing in the log shows up and the changes are not reflected on my build. Is this a similar issue was what is reported above?

I think the checks should happen as the very first step before any files are removed. I just got burned by that, not knowing step one is delete the whole /config folder.

At a minimum, the documentation should be updated to explain a little more clearly what the addon actually is doing.

1 Like

As @Undearius said. I too got burned by a delete of the /config folder, cost me a week and I still haven’t added all my zwave sensors back in.

lol this is insane. This add-on literally purges your config. This should be pulled immediately until it’s fixed. Good thing I backed up.

4 Likes

Does this really still delete everything your config folder? I have some of my files in /config under git control already, but not all of them (mainly just my yaml files, not various auto-generated things like phue.conf and the like). Will this plugin clear out the whole folder and then only leave me with the files I have in my git repo?

This erased everything in my config folder. Though I have not tried it in 2 months or so and am unaware of any updates or progress.

when i tested it, it erased my folder config too. any news about that?