Backing Up GitHub to Backblaze B2

GitHub to B2

Editor’s Note:  This post was written just before the news came out that Microsoft was buying GitHub. As a result of that news, there has been a great deal of discussion among developers about what will happen after the acquisition.

Some are concerned that Microsoft’s history with open source shows that they could change GitHub in ways that will make it less friendly to open source developers. Some alternatives to GitHub are experiencing high traffic as developers explore other open source coding communities. These include GitLab, BitBucket, SourceForge, and Launchpad.

Microsoft’s President Satya Nadella is asking developers to give Microsoft a chance to show that they will support and nurture the open source community. See Microsoft’s presentation on the acquisition. We’ll have to wait and see what happens next.

The key issue comes down to trust. Whom do you trust with your code? We at Backblaze believe we’ve earned the trust of our users through our commitment to high quality services at a reasonable price, and being transparent in our business decisions and operations. Here’s a link to a Reddit discussion entitled, How do I know that Backblaze can be trusted? that addresses who we are as a company and why encryption is important — Trust, but encrypt.

Whether you decide to stick with and trust GitHub under new ownership, or give another developer community a shot, it’s always best to have your code backed up. The post below provides a simple script to back up your GitHub code to the Backblaze cloud, which is a good idea in any case while you decide what to do next.

GitHub is the largest host of source code in the world, with over 26 million users and 57 million code repositories. That’s a lot of code.

If you’re using GitHub, you want to make sure that your hard work isn’t lost. What happens if a repository or gist is removed or changed due to involuntary deletion, a forced push, or you lose metadata information? There are some paid backup services for GitHub, and the GitHub Enterprise product includes backup, but what if you don’t use either? What’s the best way to make sure there’s a secure copy of your code in a place other than GitHub and your local computer?

Our VP of Sales, and inveterate code tinkerer, decided he could tackle this problem, so he forked a GitHub script to work with our B2 Cloud Storage. The script is below. All you need to do is sign up for a B2 account on our website. The first 10 GB of data on B2 is free, so if your backup is under that size, congratulations, this backup is on us.

The script is on GitHub at: Complete git repository backup script to Backblaze B2

Credit to Philipp Berner for the script this was based on.

For more information about backing up GitHub, see GitHub Help.

GitHub logo

Update June 25, 2018

Nathan, Solutions Engineer at Backblaze, created a batch file for backing up a GitHub repository from Windows. The batch file assumes that B2 command-line tool, Python, and 7ZIP are installed. The batch file requires that some variables (B2 account, etc) are filled in.

The script can be found at BackupGHRepoToBackblaze.bat.


About Roderick Bauer

Roderick has held marketing, engineering, and product management positions with Adobe, Microsoft, Autodesk, and several startups. He's consulted to Apple, Microsoft, Hewlett-Packard, Stanford University, Dell, the Pentagon, and the White House. He was a Ford-Mozilla Fellow in Media and Democracy with Common Cause in Washington, D.C., where he advocated for a free, open, and accessible internet for all, reducing media consolidation, and transparency in politics and the media.