DEV Community

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

Posted on • Edited 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

# Install Git
sudo apt-get update
sudo apt-get -y install git
# Configure Git with your name and email
git config --global user.name "your_name"
git config --global user.email "your_email"
  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

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more