Last active
July 27, 2026 13:49
-
-
Save wesort/dfbf15e892e8df1708cdd0c0ee73c74a to your computer and use it in GitHub Desktop.
Automatic daily backup from production site to GitHub
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
| # Shell script to automatically backup current branch to GitHub | |
| # `:!storage` — on zero-downtime sites storage/ is a symlink to shared storage. Git can't | |
| # descend a symlink, so a bare `git add .` stages the tracked storage/**/.gitignore skeleton | |
| # as deleted. Excluding the path keeps "catch everything" for everything that matters. | |
| git add -A -- ':!storage' | |
| git commit -m "[BOT] Automatic backup via cronjob" | |
| git push | |
| # Instructions | |
| # https://gist.github.com/wesort/dfbf15e892e8df1708cdd0c0ee73c74a |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example implementation using Scheduler in Laravel Forge
cd ~/example.com/ && ./autobackup.sh > /dev/null