→ When GitHub goes down...

08 October 2008

What if my GitHub repository is corrupted or deleted?

Don’t Panic! Because of the distributed nature of git, everyone always has a local full copy of the repository, complete with history. Any of your repositories, assuming they have been kept up to date, can be uploaded to the GitHub repository with no loss of data.

If the universe is conspiring against you and all copies of your repository are unaccessible, just email support@github.com – we keep offsite, encrypted backups of all repositories.

How can I share my repository if GitHub goes down?

Luckily, git has a built in server for sharing git repositories. If you have several repositories in your Code directory:


You can serve all of these with the following command:

git daemon --base-path=/Users/Matt/Documents/Code/ --export-all

The repositories can then be cloned using the address of your computer

git clone git://
git clone git://

Note: The default port git uses is 9418. Make sure that your firewall is set up to handle this.

How can I get a quick web interface?

You can run git instaweb to quickly start a network-accessible gitweb interface, for example:

git instaweb --httpd=webrick

How do I deploy my application with Capistrano when GitHub is down?

There are quite a few ways to deploy without github… ah the wonders of git!

Deploy from a local git server

Set up your repositories to be shared using git-daemon as detailed above. Set your capistrano config files to point the repository to your local repository:

set :repository, "git://YOUR_IP/rails-app"

You can now deploy your repository as normal.

Push over ssh

Another handy trick is to push the repo to your deploy server over ssh, then deploy using the local path. For this to work, you need ssh access to your deploy server, of course.

git remote add deployserver ssh://myuser@myserver.com/~/myrepo
git push deployserver master

Assuming your users are stored in /home

set :repository, "/home/myuser/myrepo"