Last active
March 20, 2024 09:30
-
-
Save bukanspot/2677e31f17a20fb11241ae583798bfb0 to your computer and use it in GitHub Desktop.
Automatically push directory to GitHub using cronjob
This file contains 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
#!/usr/bin/env sh | |
directory=<working-directory> | |
cd $directory | |
git pull origin main -q | |
result=$(git status --porcelain | wc -l) | |
if [[ $result -eq 0 ]] ; then | |
exit 0 | |
fi | |
git add .; git commit -q -m "$(date +"%c")"; git push origin main -q |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is example to push obsidian directory to GitHub
For first
Lets setup
Create or go to directory
~/.local/bin
Create file
script
with namepusher-obsidian.sh
Copy and paste script and put here (modify the script to your needs). Change
<working-directory>
with your obsidian directoryUse a cron job to run automatically
And put the code
Now, when you add new note in obsidian, your note from obsidian will automatically push to GitHub when computer reboot or start.