Installing the hub wrapper for git on Linux - lmmx/devnotes GitHub Wiki

The installation instructions for github/hub don't consider developers not using Apple OSX / homebrew 😲 You can install the Ruby gem and then install it standalone through that, but file permissions make matters awkward.

I don't understand why others are creating a private bin under the user's home directory. It's no longer suggested in hub's README, and creates a PATH problem on Ubuntu.

Standalone installation via curl

Curl installation is cleaner than via the gem, and should work for the Go release in hub v2.x too.

sudo curl https://hub.github.com/standalone -Lo /usr/bin/hub
sudo chmod 755 /usr/bin/hub

After installation add eval "$(hub alias -s)" to your startup script (.bashrc, .bash_profile etc) to have it alias over the git command.

This simply outputs alias git=hub. Presumably the idea's that if the program fails it won't succesfully assign the alias, so git will still work

Allez hub!

git clone <user>/<repo> is really handy, see the project guide for a comprehensive list of git's new "superpowers".









A bad idea:

Standalone installation via gem

If your Ruby gems version is > v1.3.2 (check with gem -v) you can make life easy take the scenic route to installation with

gem install --user-install git-hub

--user-install only works if you have ~/.gem/ruby/{VERSION}/bin in your PATH.

If you don't you'll be told so, so add this to your shell startup script:

if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi

(This is why you shouldn't use sudo gem install. The alternative is RVM)

hub hub standalone > /usr/bin/hub && chmod 755 /usr/bin/hub

For gems < v1.3.2 see here

You could then choose to gem uninstall git-hub (the gem-accessible one is slowed down by Ruby runtime and during installation a message appears, advising "heavy users" to steer clear).

⚠️ **GitHub.com Fallback** ⚠️