According to the official docs you just download a pre-compiled binary but this would leave things like
man documentation and autocompletion not working.
You can use this PPA to install
hub as a package:
sudo add-apt-repository ppa:cpick/hub sudo apt-get update sudo apt-get install hub
Hub is available as a snap now. https://snapcraft.io/hub
You can install it with
sudo snap install --classic hub.
Download Hub from Github
Extract it. I've extracted it to
Apps/directory in my home and renamed it to
hub-linux. So, in my setup, the complete path to the
Now open the
~/.bashrcfile and add the hub binary path to the
$PATHenvironment variable. Adding a line like below will work.
### Adds Hub-linux export PATH="$PATH:$HOME/Apps/hub-linux/bin/"
Don't forget to to use actual path in your setup
Add the Bash Completion
To add bash completion, we need to tell bash to source the completion file came with hub-archive. The completion file is in the
etc folder of the extracted hub folder. To do so,
.bashrc and write there these lines
### Load Hub Linux bash completion if [ -f $HOME/Apps/hub-linux/etc/hub.bash_completion.sh ] ; then . $HOME/Apps/hub-linux/etc/hub.bash_completion.sh fi
Don't forget to replace the exact path of
hub.bash_completion.sh file according to your setup
Now, You should be able to use hub bash completion
Add Hub's manpage to
Hub's man page actually came with the archive. It's in the
share folder. To add the manpage, we need to put it in the man page directory.
To do so, Open a terminal and cd to the extracted hub archive. Assuming your current directory is in the same directory where hub's
README.md reside, use this command to copy the manpage
sudo cp -r share/ /usr/ sudo chmod 644 /usr/share/man/man1/hub.1
Now you can use hub's manual page using
man hub command.
If you can't immediately use
man hub, use
sudo updatedb to refresh man db of the system.
This script should do the job on Ubuntu 16.04 with zsh.
# Install binary and documentation wget https://github.com/github/hub/releases/download/v2.2.9/hub-linux-amd64-2.2.9.tgz tar zvxvf hub-linux-amd64-2.2.9.tgz sudo ./hub-linux-amd64-2.2.9/install # Setup autocomplete for zsh: mkdir -p ~/.zsh/completions mv ./hub-linux-amd64-2.2.9/etc/hub.zsh_completion ~/.zsh/completions/_hub echo "fpath=(~/.zsh/completions $fpath)" >> ~/.zshrc echo "autoload -U compinit && compinit" >> ~/.zshrc # add alias echo "eval "$(hub alias -s)"" >> ~/.zshrc # Cleanup rm -rf hub-linux-amd64-2.2.9
Alternatively for Ubuntu 16.04 with bash:
# Install binary and documentation wget https://github.com/github/hub/releases/download/v2.2.9/hub-linux-amd64-2.2.9.tgz tar zvxvf hub-linux-amd64-2.2.9.tgz sudo ./hub-linux-amd64-2.2.9/install # Setup autocomplete for bash: mkdir -p ~/.bash/completions mv ./hub-linux-amd64-2.2.9/etc/hub.bash_completion.sh ~/.bash/completions/_hub echo "if [ -f ~/.bash/completions/_hub ]; then" >> ~/.bashrc echo " . ~/.bash/completions/_hub" >> ~/.bashrc echo "fi" >> ~/.bashrc # add alias echo "eval "$(hub alias -s)"" >> ~/.bashrc # Cleanup rm -rf hub-linux-amd64-2.2.9