How to install Git client on Ubuntu

Git is a by far the most widely used distributed version control system while being free and open source.

Despite the popularity, it's not installed by default in Ubuntu. You can install the program by following these steps;

  1. Update apt's package list
    $ sudo apt -y update
  2. Install git-core package
    $ sudo apt -y install git-core
  3. Test by running git from the command line
    $ git
    usage: git [--version] [--help] [-C <path>] [-c name=value]
               [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
               [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
               [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
               <command> [<args>]
    
    These are common Git commands used in various situations:
    
    start a working area (see also: git help tutorial)
       clone      Clone a repository into a new directory
       init       Create an empty Git repository or reinitialize an existing one
    ------ snipped ------

If you prefer to use GUI-based Git client, you can choose any of the following packages to install via apt;

  • gitk
  • giggle
  • git-cola
  • git-gui
  • gitg