How to install and configure git?

How to install and configure Git? (On Ubuntu Linux)

Git official documentation provides exact steps which everyone can follow to install Git on their system based on their system configuration (OS).

You can find the documentation to install Git from here

To check if git is installed on your system, run the following command on terminal / command prompt. This command will return the version of git installed on your system

git --version

I have a script which I’ll run to install git whenever I’m switching to a new laptop. I’ll attach the script file below, you can use it too. This script can run only on Linux (especially Ubuntu flavor). As most developers use Linux and I love using it, I written this script.

Follow the below steps to install Git via script

# Install Git
sudo apt-get update
sudo apt-get -y install git
# Configure Git with your name and email
git config --global "your_name"
git config --global "your_email"
Create file and copy the below content
  1. Copy the above content to a file
  2. Replace “your_name” and “your_email” with your name and email respectively
  3. Save the file as
  4. On terminal, navigate to the folder where you saved the file
  5. Make the file executable by running the below command on terminal
sudo chmod +x

Note: This step will ask you to enter your system password

4. Run the file using the below command


Run git --version to verify the installation of Git. This command will return the version of git installed on your system.

That’s it. We’re done with setting up git on your local machine.

Remember to save the file in a safe place to install git quickly in your system, if you switch your laptop in future.

Please follow my instagram account to receive quick updates




Learn any concept under 5 minutes.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Use Sandbox TDS APIs to manage TDS Compliance?

Learn Haskell in 2022 with These 15 Resources

Build Oracle Graph on Docker (Part 1/2)

How To Create a folder in a GitHub Repository?

How Paths and Directories Work

Notification Engine as a Microservice

Four In-Depth Explanations To SQL Interview Questions From Real Companies

What are data structures and algorithms in computer science?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
5 Mins Learn

5 Mins Learn

Learn any concept under 5 minutes.

More from Medium

Getting started with Git and GitHub: Beginner’s guide

Wget Command

How Git works?

Getting-init Some Basics on Git and GitHub