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 firstname.lastname@example.org – 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:
/Users/Matt/Documents/Code/ rbvimeo/ rubyzilla/
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://127.0.0.1/rbvimeo git clone git://127.0.0.1/rubyzilla
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://email@example.com/~/myrepo git push deployserver master
Assuming your users are stored in
set :repository, "/home/myuser/myrepo"