I have a few beanstalk and springloops hosted git repositories. These are great online hosted git/svn/mercurial repositories, with cool deployment features for pushing to multiple servers. However, the free accounts are limited to a single private repository per account, obviously paid accounts don’t have these limitations (prices start at about $10/month). I’ve managed to work around this in the past by setting up an account for each project, however this is a little unpractical if you have more than a few accounts. I was about to change to a paid plan when I discovered bitbucket do a free unlimited account (with unlimited private and public repositories), so I decided to migrate everything across to bitbucket.
Bitbucket have an option for importing existing online repositories, however they don’t have an option for either beanstalk or springloops and I couldn’t get the git/github option to work with them.
However all is not lost and its very simple to upload your existing local git repository, whilst keeping all of your commit history.
These are the steps to upload your existing local repository to bitbucket, however they would apply to any online repository (GitHub, Beanstalk, Springloops, Gitorious, etc….) as the process would be the same.
- Register with bitbucket or your chosen hosted revision control provider.
- Upload your ssh public key.
- Create an empty repository for your project. Once you have created the new online repository, get the new URL. It should be similar to: email@example.com:username/myNewRepo.git
- Go to your local folder that contains your existing repository:
- cd /path/to/your/existing/repo
- Upload your existing repository to Bitbucket:
- git push –mirror firstname.lastname@example.org:username/myNewRepo.git
Once its finished uploading everything, thats it done and you have successfully migrated your local repository to its new hosted home. If you login to your bitbucket account, select your repository and then check the commits you should see your full commit history.