How To Install Git on Ubuntu 20.04 LTS Focal Fossa Linux

The objective of this guide is to install and perform basic setup of Git on Ubuntu 20.04 LTS Focal Fossa Linux.

In this tutorial you will learn:

  • How to install Git
  • How to set global username
  • How to set global email
  • How to check git version

Git on Ubuntu 20.04 LTS Focal Fossa Linux

Git on Ubuntu 20.04 LTS Focal Fossa Linux

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software Git
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How To Install Git on Ubuntu 20.04 step by step instructions



  1. First step is to open a terminal and install Git by using the below command:
    $ sudo apt install git
    
  2. Confirm the git installation by checking for a git version:
    $ git --version
    
  3. Set your global user name and email. Example:
    $ git config --global user.name "Lubos Rendek"
    $ git config --global user.email "web@linuxconfig.org"
    

    Alternatively, set your configuration directly by editing the ~/.gitconfig file:

    [user]
            name = Lubos Rendek
            email = web@linuxconfig.org
    
  4. List global git settings to confirm your git configuration:
    $ git config --list