Importing to BitBucket

When bitbucket added git to their code hosting service, I signed up to try out the service. Primarily since they offer unlimited free private repositories, which is perfect for one-coder projects like this blog. Each repository also gets a wiki and an issue tracker.

Creating an account was straight forward, I then had to import my self-hosted git repository to bitbucket. This wasn’t too difficult, after opening port 9418, which is used by the git protocol, I did the following.

1. Let git know that I wanted to export my repository


cd /var/local/git/foo.git
touch git-daemon-export-ok

2. Run the git daemon, temporarily.


git daemon --base-path=/var/local/git --export-all

You could run it idefinitely, but I’d rather it run when I need it to.


git daemon --base-path=/var/local/git --detach --syslog --export-all

3. Import the repository into bitbucket with this repository URL.


git://oscarm.org/foo.git

Once the import was successful, I stopped the git daemon. The final thing to do, is update any repositories that used my local bare repository as the origin to use bitbucket as the origin. In each repository, I had to edit the .git/config file and update the origin url to something like:


url = git@bitbucket.org:omerida/foo.git