DEV Community

Cover image for How to install and configure git?
5 Mins Learn
5 Mins Learn

Posted on • Updated on

How to install and configure git?

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
Git - Installing Git

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
Enter fullscreen mode Exit fullscreen mode

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

  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 install_git.sh

  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 install_git.sh
Enter fullscreen mode Exit fullscreen mode

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

6.Run the file using the below command

./install_git.sh
Enter fullscreen mode Exit fullscreen mode

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 install_git.sh file in a safe place to install git quickly in your system, if you switch your laptop in future.

Subscribe to our newsletter to receive more such insightful articles that get delivered straight to your inbox.

Please follow my instagram account to receive quick updates

Top comments (0)