- May 22nd, 2013
- Write comment
I moved my git repositories to BitBucket and it was super-easy.
As part of my annual digital spring cleaning, I decided it was time to find a new home for the dozen or so git repositories taking up space on my virtual server. I’d set up gitosis a few years back (way back before gitolite was even a thing), without any fancy web interface or DAV access. Only command-line access, operating under the full Ron Popeil server-admin philosophy: Set it and forget it.
All was fine and dandy until I realized that having several working copies (along with the master copy) of a dozen repositories, operating on the same server, was kind of silly. (No, I didn’t plan it that way, but, well, you know. Things happen.) One of those repositories was a few hundred megabytes on its own. I started to get notifications about the disk being full and such. I hate those notifications. I actually hate all notifications. It goes very much against the “forget it” part of the aforementioned server-admin philosophy I outlined in great detail above. So, I went to the Cloud to find a new home for my gits.
GitHub charges by the repository. Bleh; no thanks. As one writer put it: GitHub charging by the repository is as asinine as if Dropbox charged users by the folder. Then I got all caught up with the times and discovered that not only is BitBucket in the git game now, it’s also offering essentially unlimited repositories for up to five users, for the price of free.
After a few hours of researching how best to migrate all this data and all my commit history over to its new home, I found a very easy way to get it done, thanks to Oscar Merida. First, you create a new repository in BitBucket. Then run the following two commands in the folder where your repository currently lives:
git remote add origin firstname.lastname@example.org:user/newproject.git git push -u email@example.com:user/newproject.git master:master
Repeat for each repo.
On my first attempt, however, I did run into one problem, which was actually very easily solved, thanks to BitBucket’s excellent documentation. The first time I tried a push, I got the error:
Permission denied (publickey).
Which meant that BitBucket didn’t know that it was okay to accept my pushes. So I just followed their instructions for how to fix it, and, boom. Done.