Created
December 3, 2024 08:56
-
-
Save andreaso/ab5033681869312f1aa12ac0c2b3fe3f to your computer and use it in GitHub Desktop.
Auto-push notes git repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
set -o nounset | |
cd /home/andreas/notes | |
[ -n "$(git status --porcelain)" ] || exit 0 | |
git add . | |
git commit --no-gpg-sign -m "auto-commit" | |
GIT_SSH_COMMAND="ssh -o IdentitiesOnly=yes -i /home/andreas/.ssh/gh_notes_ed25519" git push |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.config/systemd/user/gh-notes-sync.path | |
[Unit] | |
Description=Trigger pushes of the ~/notes git repository | |
[Path] | |
PathChanged=/home/andreas/notes | |
Unit=gh-notes-sync.service | |
[Install] | |
WantedBy=default.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.config/systemd/user/gh-notes-sync.service | |
[Unit] | |
Description=Pushes the ~/notes git repository | |
[Service] | |
Type=oneshot | |
ExecStart=/home/andreas/.local/libexec/gh-notes-sync |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment