Git Commit in the UI!

I just wanna share my new Git commit function to UI!

It looks like this!
gitcommit

Here is the configuration!

shell_command:
  gitcommit: '/bin/sh gitupdate.sh "{{ states("input_text.gitmessage") }}"'

input_text:
  gitmessage:
    name: Git Commit Message

script:
  gitcommit:
    sequence:
      # This is Home Assistant Script Syntax
      - service: shell_command.gitcommit

gitupdate.sh
(Your hass need to be able to access this file. And you need to set git authentication to cache its login details in your hass container / where your hass is running


#!/bin/bash

cd locationtohass

git add .
git status
git commit -m "$@"
git push origin master

exit
1 Like

Where did you place the gitupdate.sh file?

Under HASS Root folder @duceduc

Hi,
I’m trying to do the same thing, but I’m having problems with the ssh key.

I think my problem is with bellow instruction.

gitupdate.sh
And you need to set git authentication to cache its login details in your hass container / where your hass is running

Could you give me some hint on who to do that?

Did you figure out a way around this?
I am getting the below error.

Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.