Running .sh from an automation

I’m able to run it from the terminal, and I ran chmod 755 /config/ha_gitpush.sh with the same issues

Hold the bus - why do you have /home in the path to the command?

To be honest, just something someone recommended on a different forum post.

Try just /config/ha_gitpush.sh

Error running command: `/config/ha_gitpush.sh`, return code: 128
NoneType: None

What’s in the script?

like the docs say, enter the HA container and try the command.

cd /config
git add .
git commit -m "config files on `date +'%m-%d-%Y %H:%M:%S'`"
git push -u orgin master

Works fine from both inside the docker container, and running it thru a terminal addon, just not thru automations.

I suspect that git isn’t available in the HA container.

Alright. How would I go about fixing it? I just don’t get why I can run it from within the HA container, and thru the terminal, but not the automations.

It is in mine.

1 Like

Set your log level to debug.

hey, same problem for me, im using shell_command for turning off windows PCs

 shell_command:
     turn_off_pc: "net rpc shutdown -f -t 2 -C 'Turned off from HASS' -U <winlogin>%<winpass> -I <winIP>"

im getting the same error as TS when trying to execute that from HASS (automation/switch)

Error running command: `net rpc shutdown -f -t 2 -C 'Turned off from HASS' -U <winlogin>%<winpass> -I <winIP>`, return code: 127

NoneType: None

that command works fine when executing manually from Advanced SSH & Web Terminal addon

seems like this started to happen after last Home Assistant updates
@bbro44 have you found a solution to the problem?

@nickrout Still just

Error running command: `bash /config/ha_gitpush.sh`, return code: 128
NoneType: None

@lemeshovich No

seems like the issue fixed for me with 2023.7.0 HASS update

Still having the same issue here on 2023.7.2…

Anyone?

mostlychris mentions running this command in Terminal:

git config core.sshCommand 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa -F /dev/null'

in his YouTube video (Share Your Home Assistant Configs on GitHub Automatically. - YouTube). Doesn’t do it for me, does it work for you?