Tag: github

5 Easy Steps to Archive a Github Repo on Bitbucket

So I love Github. I use it for personal projects and for work. I’m happy to pay for the service but I find myself constantly running out of space because of old private repos. Most of the time these finished (or abandoned) projects are not worth keeping around. Bitbucket offers free unlimited private repos, so using it for archiving projects seems like a great option.

Here’s the easy guide to archiving (or moving) a project from Github to Bitbucket.

Archive a Github Repo on Bitbucket by omarrr

1. Import the Github repository to Bitbucket

Probably the easiest part. Bitbucket has implemented a flawless Import your GitHub repositories feature. Authenticate with Github and you are done (Bitbucket will send out an email once the import is complete). If your project was private in Github it’ll still be private once it gets ported to Bitbucket.

2. Add the new Bitbucket remote on your local machine

This will allow you to use bitbucket as another remote should you want to continue doing development.

git remote add bitbucket <https://omarrr@bitbucket.org/omarrr/PROJECT>

Check your setup to make sure all is good.

git remote -v

    bitbucket   https://omarrr@bitbucket.org/omarrr/PROJECT.git (fetch)
    bitbucket   https://omarrr@bitbucket.org/omarrr/PROJECT.git (push)
    origin  git@github.com:omarrr/PROJECT.git (fetch)
    origin  git@github.com:omarrr/PROJECT.git (push)

3. Setup the new origin repo

If you are going to delete the repo from Github and —potentially— start using Bitbuket instead, you’ll want to setup origin to point to the new Bitbucket remote instead of Github. We do this so that we can keep working with the new repo as if it was the old one by pushinng and pulling to Bitbucket as the default remote.

git remote rename origin github
git remote rename bitbucket origin

Again, check that everything is good

git remote -v

    github  git@github.com:omarrr/PROJECT.git (fetch)
    github  git@github.com:omarrr/PROJECT.git (push)
    origin  https://omarrr@bitbucket.org/omarrr/PROJECT.git (fetch)
    origin  https://omarrr@bitbucket.org/omarrr/PROJECT.git (push)

4. Done!

Since your project is safe in Bitbucket now, you can delete it from Github. You can see below how to.

4.1. Create a backup or clone (Optional)

Clone your repo to retrieve a copy of the full history of your project with all branches, tags, etc.

git clone <https://omarrr@bitbucket.org/omarrr/PROJECT>

Generate a ZIP


Delete the clone

rm -rf <PROJECT>

4.2 Delete the project from Github (Optional)

It’ll be a good idea to confirm that Bitbucket has been properly setup and/or create a clone of the repo (see above) before proceeding (just saying).

Go to the “Danger Zone™” in the project settings page on Github (eg: https://github.com/omarrr/PROJECT/settings) and click “Delete this Repository”.

Finally remove the remote from your local machine

git remote rm github

Once more, check that everything is good

git remote -v

    origin  https://omarrr@bitbucket.org/omarrr/PROJECT.git (fetch)
    origin  https://omarrr@bitbucket.org/omarrr/PROJECT.git (push)    

5. Done!

No, really. We are done now.

Introduction to version control with Git and GitHub

In the last year I’ve moved more and more towards Git and since I’ve started using Github I don’t want to go back to old SVN. Git is fast and reliable version control system, and Github is the perfect tool for version control, doing code reviews and managing feature development and hot fixes.


The first reason that made Git so attractive was managing more than one paralel paths of development at once (eg. feature development that needs to happen in paralel with the deployment of hotfixes). With SVN all work not related to the hotfix would have to wait to be committed to the server, or very careful measures would have to be taken to avoid code rollovers. The concept of branches is integral to the way Git works and makes it extremely simple to switch development paths and manage complicated deployments. Also, unlike SVN, Git is fast.


Git branches allow to really quickly archive the current state of the project, change context and start experimenting. If the experiment goes awry it’s a breeze to get back to the original state, if it’s a success it can become the new development branch. Great for big refactoring efforts, experimental features, etc.

Branches also facilitate colaboration among many developers and some successful branching models have been set up to assist big groups to cooperate successfully. We follow this model (or slight variations of it) in many of our projects.

Server-less commits

Cloning a Git repo actually clones the whole project not just the files of the current state of the app, which means that you have a perfect copy and are free of using the server repo. Git is great for offline development since developers can commit files locally, repeatedly, without a server and finally push their work to the repo once online (with the full history of commits).


Github is the perfect companion to Git. Since I have more and more adopted the cloud paradigm. One big advantage of Github is not having to physically clone a repo in order to be able to review code, check the history of a branch, review pull requests, etc. Finally Github is free for Open Source projects which makes it really attractive as a starting point for many.

Link to code

Something I really enjoy about Github is being able to link to sections of code. As simple as this might seem there never has been an easy way to do this.

Pull requests

Instead of blindly merging new code into the repository, developers can submit a pull request, a request to merge their code into the main branch (or trunk, or master) that can be reviewed, commented on and approved. Github can display the pull requests, conversations and resolutions. Pull requests are technically a Git feature, but the way Github handles them makes it pretty awesome to use.

Git Blame

Last feature that I really enjoy is blaming. Blaming allows anyone to determine the author of each line of code in a file. This is another feature that belongs to Git (also to SVN), that is greatly enhanced thanks to Github’s UI.


The Git Community Book: Freely available online and maintained by the community.

Book. This book has been built by dozens of people in the Git community, and is meant to help you learn how to use Git as quickly and easily as possible.

Pro Git: Published by Apress, the book is free online.

Here you can find the full content of the book, a blog with tips and updates about Git and the book and open source projects related to Git or referenced in the book.