Thursday, May 6, 2010

Initial Git Push to RubyForge (Xbee Project)

Recently I became part of a team that is beginning to do quite a bit of work in Ruby. As a group committed to open-source, we immediately gave back in the form of a Ruby Gem. Our gem is called Xbee for Ruby and is focused on reading incoming data from the Xbee RF microcontroller. It's very low-level and exciting stuff.

Joining RubyForge is easy. Pushing to your Git repository is not. There is some documentation, but it is sparse and makes things difficult for people that are brand new to ssh public keys. So let's go through the steps from the beginning:

  1. Head to and click the New Account link at the top of the page

  2. Once signed up, log into your email account and confirm

  3. Now that you're logged in, you can register a project by clicking the Register Project link near the top of the screen

  4. Fill in the requested details of your project: full name, purpose, pick a license, description, unix name, and choose Git as your SCM

  5. Once your project is approved, you're ready for your first commit...and this is where it gets tricky for a newcomer. Click the My Account link near the top of the page

  6. Scroll to the very bottom of the page and in the Shell Account Information section, click the Edit Keys link.

  7. If you're on Mac or Linux, fire up the Terminal and enter ssh-keygen -t dsa -C "your_email@email_provider", preferrably using the email address you've configured Git with.

  8. Terminal will prompt you for a place to save the newly generated keys. It automatically suggests ~/.ssh/id_dsa, and for most uses I'd say this is more than fine.

  9. So now you've created two files in your ~/.ssh/ directory. Open the public key file with your favorite text editor like so: vi ~/.ssh/

  10. Select all of the file, including ssh-dss and the email address you added and copy

  11. Head back to the RubyForge window you still have open and paste your public key in the box

  12. Click the update button and be prepared to wait until the top of the hour for your key to be added

  13. If you haven't done so already, head to the folder where your gem files are stored and initialize your Git repository with git init and commit everything with git commit -a -m "initial add"

  14. Next you'll want to add the remote RubyForge repository with git remote add origin

  15. Finally the last step! If the top of the hour has passed since you added your public key to RubyForge, you should be ready to push to the remote repository with git push origin master:refs/heads/master. Done!

A little more difficult than we would have liked, but we did get there eventually and now it's quite easy.