Table of Contents
Why do I need a GitHub backup?
Backups help prevent lost work, but they also ensure your data is always accessible. A secure backup and recovery solution for business-critical information is also often required to comply with various certifications such as SOC 2.
Having a complete copy of your repository (saved externally) protects you from relying on external services, i.e. GitHub. After all, no service can guarantee 100% uptime. Thus, even in the unlikely event of a GitHub outage (which has happened!), you’ll be able to access your repository’s data. Automated backups ensure your data backups are always secure, up to date, and easily restored. After all, a backup you can’t restore isn’t much of a backup at all.
How to back up a GitHub repository
When backing up the data in a GitHub repository, there are a few different options. You can either manually download and store your data, you can build custom scripts to back up your data, or you can use a BaaS (backup-as-a-service) provider. These apps manage your data’s security for you by automatically running backups nightly. Data backed up with Rewind can be restored directly to your GitHub repository or synced to your cloud storage of choice, although your subscription includes a 365-day retention period on the cloud, with no size limits.
How to restore a repository to GitHub
The BackHub restore app must be installed before you can restore a backup. The BackHub restore app is Rewind Backups for GitHub’s official restore app, as Backups for GitHub was formerly known as BackHub.
For restoring a backup, write permission to at least one repository is necessary. The BackHub restore app is installed separately so that you can remove the app and its permissions after the restore has been completed.
The restore app automatically creates a new repository in your GitHub account with the name given in the restore dialog and restores the full repository, including its metadata, into this repository.
Install the BackHub Restore app
- Go to the GitHub App directory and start the installation.
- During the installation process, limit access to “Select repositories” and pick a random repository. (It’s not possible to choose none, unfortunately. The restore app creates a new repository, so the selected repository here isn’t affected in any way.)
Initiate the restore app
- In the Rewind Vault, search for the repository to restore.
- Click the panel to open the details.
- In the panel footer, choose the snapshot to restore from.
- Click “Restore.”
- Open your GitHub account and check the restored repository. It may take a couple of minutes up to an hour for the restore to complete, depending on the size of your repository.
Note: Do not change anything in the repository while the restore is in progress (for example, don’t create an issue or try to commit).
Learn more about Backups for GitHub here.What is a cloud-to-cloud backup?
A cloud-to-cloud backup simply refers to data stored on one cloud server that’s backed up on another cloud server or storage provider. Using two different cloud providers means that in the unlikely event one goes down, you’re covered.
Why should I use a cloud-to-cloud backup?
There are many benefits to outsourcing your backups with a cloud-to-cloud backup solution. BaaS (backup-as-a-service) apps are solely dedicated to data backups, freeing up your development team to work on what matters while guaranteeing the code they rely upon is continually available. There’s no need to write a custom backup script, keep up with GitHub’s API changes, monitor your backups, or document backup and recovery procedures – that’s what BaaS apps are for.
With Rewind’s Backups for GitHub, you can have a full backup of your repositories in minutes, with the ability to restore data directly to GitHub. This means recovering from data loss is a minutes-long process, not days or weeks. Private repositories are kept secure with integrated authentication from GitHub.
How do backups help with audit compliance?
Backups aren’t just essential for daily operations: repository backups are essential if you’re seeking to achieve or maintain SOC 2 compliance. SOC 2 auditors will check that backups of certain application and database components are performed daily. Code backups support recovery in the event of a service failure, and they’re one more safeguard to help get your software back into the hands of your customers – quickly.
SOC (System and Organizational Control) is an audit that rates companies on their performance in TSC (Trust Service Criteria). These guidelines cover everything from databases and software applications to cloud management and even marketing campaigns.
Becoming SOC 2 compliant can feel like a huge undertaking, so it’s essential to break the process into bite-sized chunks. The goal of SOC 2 is to create a set of guidelines that will lead to applications built with privacy, security, availability, integrity, and confidentiality in mind.
How to export your GitHub data
Export via Amazon S3
The easiest way to download all your data at once is to connect an Amazon S3 bucket via Cloud Sync and download all data using the S3 CLI or your preferred client.
With Rewind Backups for GitHub, you can easily download files of the master branch from any of your backup snapshots.
Another option is to clone the repository directly from Rewind’s servers.
Download GitHub repository metadata such as issues
Besides the repository itself, you can also download the metadata associated with it. The download comes as a .ZIP file containing various folders for each type of data. Metadata is stored in JSON format.
Download GitHub wiki
If you have a wiki connected to your repository, you can download that as well.
Wikis are included in the backup of your GitHub repository. A GitHub wiki is simply a separate repository with markdown files containing your wiki pages.
How to recover a deleted repository in GitHub
For those that need a little more peace of mind than what GitHub offers, a BaaS cloud solution like Rewind is the best option. While Rewind Backups for GitHub (formerly known as BackHub) is a paid service, it offers several important features on top of simple repository recovery:
- Nightly backups
- Sync to Amazon S3
- Audit log
- Backing up issues, milestones, pull requests, etc.
- Restore directly to GitHub
- No 90-day limit on backup retention
If you want peace of mind, then sign up for a free trial to give Rewind a try.
Here’s the process for installing and recovering a GitHub repository using Rewind Backups for GitHub.
After signing up for a free trial, you’ll be directed to an install screen that sets up permissions with your GitHub account.
Select “All repositories” to back up everything, or use the dropdown to choose the relevant repositories.
From there, log in to GitHub and authorize Rewind as an app.
Once Rewind is configured, you’ll be taken to the Rewind dashboard. You will see a list of all the repositories you’ve selected, including a timestamp of the last backup. Rewind will keep your backups up to date so you can recover them at any time.
Here’s a sample of some of the information it displays on each repository:
Restore from Rewind
To complete the process, try restoring a repository from BackHub’s backups.
Click the Restore button in the repo dropdown.
In the restore popup, you will be asked to authorize the Rewind app again. This installs a temporary app that you can remove after restoration is complete.
Once the app is authorized, click the Restore button in the Rewind dashboard again. You’ll get a chance to name your repo. In this case, we’ll stick with the default <REPOSITORY_NAME>-restored format and leave it private.
Once you hit restore, Rewind will get to work in the background. There is a status message at the top of the dashboard telling you the current state.
That will quickly change to a success message.
Now when you go to your GitHub account, you’ll see the restored repository.
If your code is stored in a GitHub organization account, Rewind requires a new plan for each organization. These can be set up from the dashboard as well.
Rewind Backups for GitHub allows you to store your backups in your own S3 bucket where they’re unaffected by GitHub downtime, but you have to plan ahead because it’s not built into GitHub by default.
Just like database backups, code backups should be considered early in the software development lifecycle. Once a repository is more than a toy project, you should have a backup and recovery plan, as mission-critical code could be lost in a data breach, account compromise, or accidental deletion. If you’re interested in getting serious about code backups, check out Rewind’s GitHub repository backup and recovery tool.
What can I do if GitHub is down?
If GitHub is not available, the only way to access your data is by cloning from Rewind servers or through your Amazon S3 Bucket if you have it connected. We offer a disaster recovery service for enterprise customers.
Our service works with GitHub OAuth and is dependent on the GitHub API. You can check the GitHub API status here.
If GitHub is not available, you cannot log in to the Rewind user interface. However, if you have an ssh key added to your GitHub account and have turned on the “Clone From BackHub” feature in your account settings, you can clone your repositories directly from Rewind servers. Another way to access your backups if GitHub is not available is to sync them to an Amazon S3 Bucket.
If you have an enterprise plan with an enterprise SLA, you can also contact us to perform a disaster recovery of your data.
How do I back up selected GitHub repositories only?
By default, Rewind creates backups of all GitHub repositories that it has access to.
If you want to back up only selected repositories, you can simply limit access to those repositories during installation or later in the app settings.
In the installation dialog, you choose whether to give access to all repositories or to only select repositories. Choose “select repositories” and enter the names of the repositories to back up.
What is BackHub? I thought this was a Rewind app?
BackHub is the original name of Rewind Backups for GitHub. When Rewind acquired BackHub in 2021, the app was renamed to match the rest of the Rewind apps. Otherwise, there is no difference between the service provided by BackHub and the service provided by Rewind Backups for GitHub.
Why do I need a separate app to restore my GitHub data?
The Rewind Backups for GitHub app only has read permissions for your GitHub data. This allows it to back up your GitHub data automatically.
The Rewind Backups for GitHub (BackHub) restore app requests read and write permissions for your GitHub repository. This allows it to restore data directly back into your GitHub instance. Then, once the restores are complete, you can remove the Backups for GitHub (BackHub) restore app for added security.
The Rewind Backups for GitHub (BackHub) restore app must be installed before you can restore a backup. This is a cloud installation and does not require any installation on your local machine.
Learn more about Backups for GitHub here.