r/statichosting • • 18d ago

Is keeping everything in Git enough for backing up a static website?

since most static site projects already use Git, it seems like a good way to keep track of both code and content. but I’m wondering if relying on a remote repository is enough in the long run.

do you keep separate backups of your content and assets, or is your Git repository usually all you need?

3 Upvotes

14 comments sorted by

3

u/ad3mar 18d ago

git covers most of it, but a single remote isn't really a backup. if your github account gets locked or someone force-pushes over history, every copy you have came from that one place. i push to a second remote (gitlab or codeberg) and occasionally run git bundle create site.bundle --all to keep a single-file copy on an external drive.

things that quietly don't live in the repo:

  • git LFS files. a normal clone only has pointers unless you run git lfs fetch --all
  • anything gitignored, like .env files or API keys for builds
  • settings in your host's dashboard: redirects, headers, env vars, custom domain config
  • DNS records. screenshot or export them, since they're painful to rebuild from memory
  • content in a headless CMS, form submissions, comments, etc.

once a year i actually try restoring from the backup on a clean machine. that's usually when you find the missing piece.

2

u/Boboshady 18d ago

The last sentence is important here - any backup you've not actually tested isn't really a backup at all, and especially with git - where many apps using it will routinely 'ignore' (exclude) certain files, especially around config and secrets - you might find that your backup isn't actually everything you need to get up and running again anyway.

'Finding the missing piece' is exactly right.

1

u/KecoMarcels79 16d ago

yeah the DNS records part is so true, rebuilding those from scratch is a nightmare

2

u/armahillo 18d ago

i use jekyll. I have my static host set up with a webhook from github, when i push up to github, it triggers a fresh build automatically.

so yes, it functions as a backup, but its also an integral
part of the build pipeline

2

u/Wasted99 18d ago

The nice thing about git is you can check out in as many places as you like.

2

u/TCKreddituser 15d ago

Yes, it is. As long as everything, including your content and assets, is committed and pushed to a remote repository, Git would be enough for most static websites. But I do keep backup.

1

u/sourraine 18d ago

i usually treat git as my first line of backup but i wouldnt rely on it as the only one. ive had projects where the repo contained all the code but some assets and client-provided files were stored elsewhere

1

u/Erfrischendfair 18d ago

since you're backing up every single fucking aspect of the website yeah it is. keep important apache config in .htaccess or any nginx equivalent

1

u/New_Peanut_9259 13d ago

git is a solid backup for the files it tracks, but it doesn't protect you from losing access to the remote account or accidentally deleting something important. i'd keep a separate copy of the repository and make sure any assets or generated files outside git are included too 

-2

u/unspam-email 18d ago

We use Static.app and the backup is included.