How To Install And Configure Git On Linux Mint

bikodes

BiKodes

Posted on April 5, 2022

How To Install And Configure Git On Linux Mint

Installing Git On Linux Mint

Git has to be installed on the users computer to capacitate its use by the respective user.It can be either downloaded and installed directly or installed via the command line.

The detailed installation process below uses the _apt _command.It is recommended to update and upgrade your Ubuntu system before installing the Git package.

  1. update the apt package listing:

            **$ sudo apt update**
    
  2. upgrade the system with the command:

            **$ sudo apt upgrade**
    
  3. After successfully updating and upgrading the Linux Mint system, install Git with the command:

            **$ sudo apt install git**
    

    Press ‘y’ to continue installing Git.

  4. Verify the installation when the Git is successfully installed:

            **$ git --version**
    

Configuring Git

The user needs to confirm if is already installed on their PC using a command that exposes the Git version installed:

            **$ git --version**
Enter fullscreen mode Exit fullscreen mode

The Git configuration can be executed from the command line. This refers to the process of setting a name and email address.The name and email are used while committing changes on the Git repository.

The following commands are used for configuration:

  1. To set a global commit name:

    **$ git config –global user.name <“Your Name”>**
    
  2. To set the global commit email:

     **$ git config –global user.email <“Your Email”>**
    
  3. Run the following command to check and verify the changes after the global commit name and email are set:

       **$ git config --list**
    

    The data output verifys that the global commit name and email are sent successfully.

  4. You can review what is currently stored in the .gitconfig file by using the cat command:

         **$ cat ~/.gitconfig**
    
  5. You can edit the configuration settings any time if you want to change the global commit name and email or when the changes were not made correctly using the following command:

            **$ sudo nano ~/.gitconfig**
    

    Any changes can be made in Git configuration file once it is opened in the nano editor.

  6. This information can be stored for quicker access in the future using the following
    command:

            **$ git config --global credential.helper cache**
    
    This is for dedicated servers being run by 1 or 2 people that are trustworthy as the 
    information isn’t stored securely and any user with access to the server can read it.
    
  7. User are advised to cache only for a limited time for increased security, that is, if
    they must use credential helper.

i.e Lets assume you are going to be working today using Git for 1-2 HOURS and won't be using it there after. The expiry can be set to 3 hours.

$ git config --global credential.helper "cache --timeout=10800"

This secures your Git as credentials will be deleted immediately after 3 HOURS.
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
bikodes
BiKodes

Posted on April 5, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related