How to install hub for GitHub on Linux Mint and Ubuntu

#

hub is a command-line wrapper for git.

It’s not immediately obvious how to install it from a fresh Ubuntu or Linux Mint install, so here goes.

Install Ruby

First off, hub is a Ruby program. So we’ll have to install Ruby. Open up your terminal (Ctrl+Alt+t) and run:

$ sudo apt-get install ruby

As of time of writing, that installs Ruby 1.8.x.

Download hub

Hub’s suggested path is to create a bin folder in your home directory. I don’t know if this is better than installing into the more standard /usr/bin/, but here goes anyway:

$ mkdir ~/bin

Now download the hub script:

$ curl https://hub.github.com/standalone -Lo ~/bin/hub

The hub script file now needs to be made executable:

chmod 755 ~/bin/hub

Note: Linux Mint will automatically find this ~/bin folder next time you log in. So log out and log back in again. Ubuntu may not do this, I don’t know. If it doesn’t, you’ll have to find out how to att the ~/bin folder to your PATH variable.

Now you’re done. Open your terminal, and run:

$ hub