GitHub Backups With Veeam

Disclaimer:
I’m not a professional developer. This guide is intended to demonstrate the “art of the possible” rather than serve as production-ready code. Use this example with caution, and always test thoroughly in your environment before relying on it for critical tasks. Github Repo

Introduction

Backing up critical repositories is an essential part of any DevOps workflow. While GitHub provides redundancy and version control, a dedicated backup strategy ensures resilience against accidental deletions, malicious activities, or service outages.

In this blog, I’ll walk through how we can combine smart scripting and Veeam to securely back up GitHub repositories for long-term protection—ensuring immutable, encrypted copies of your data.

Process and Testing

To get started, we need to create a backup job that targets an S3 storage location—the home for our GitHub repository bundles. These bundles are generated using a pre-script that automates the process.

Steps to Configure the Backup Job

  1. Create an Unstructured Backup Job

  2. Select the Primary Backup Repository (In my case, a local NAS)

  3. Configure the Pre-Script

    • In the same tab, go to Advanced → Scripts
    • This is where we configure the PowerShell script to run before the job execution. This script updates the S3 location with the latest repository backup from GitHub.

    How It Works:
    The pre-script connects to GitHub, iterates through all available repositories, and performs a Git mirror of the main branch. Once that’s done, it compresses the repositories into ZIP files and uploads them to S3. This seamless integration ensures that our backups are automated, efficient, and always up to date.

  4. Select a Secondary Backup Location (Veeam Data Cloud Vault)

  5. Configure the Backup Schedule and Finish Setup

Verifying the Backup

Once the job runs successfully, we can see that the pre-script executed correctly and that new backup objects are now in our S3 bucket.

Success! Our GitHub Backup is Secure

Great news—our script worked flawlessly! I have five repositories in my GitHub account (right next to my smiling face 😃), and inside the S3 bucket, we now have five corresponding ZIP files, one for each repository.

But we didn’t stop there. We’ve also implemented the 3-2-1 backup strategy to maximize data security:

  • Primary copy – The production repositories live in GitHub.
  • First backup – Exported and stored in an S3 bucket.
  • Second backup – Saved on a local NAS for quick recovery.
  • Final backup – A secure, immutable, and encrypted copy in Veeam Data Cloud Vault.

This multi-layered approach ensures that our code is protected against accidental deletions, corruption, or cyber threats. No matter what happens, our data remains safe.

Restoring Backups

As we all know, a backup is only as good as its restore. Luckily, we have that covered!

Our process includes a restore script that allows us to retrieve the most recent backup and restore it in two ways:

  • Option 1: Restore just the code to a local environment.
  • Option 2: Create a new GitHub repository and restore the code there, ensuring we can bring it back to its last known good state.

Important:
While Veeam isn’t directly involved in the restore process, it plays a critical role in securing our backups. Veeam ensures that everything stored in S3 remains immutable, encrypted, and protected for long-term retention.

At the end of the day, this isn’t just about backing up data—it’s about unlocking the art of the possible, ensuring resilience, and keeping our code safe no matter what happens. 🚀

Conclusion

Integrating GitHub backups with Veeam provides long-term retention and secure off-site storage. By automating repository archiving and leveraging object storage, organizations can safeguard their codebase against data loss scenarios.

I hope this guide was helpful! As always, keep learning and stay secure! 🔒💡

Further Reading

A special nod to Michael Cade, who wrote about a similar topic back in 2019! If you’re interested in additional insights on GitHub backups, be sure to check out his blog and the Kasten Blog for more details:

These resources provide valuable perspectives on securing your repositories and ensuring data resilience.