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
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
- Copy the above content to a file
- Replace “your_name” and “your_email” with your name and email respectively
- Save the file as install_git.sh
- On terminal, navigate to the folder where you saved the file
- Make the file executable by running the below command on terminal
sudo chmod +x install_git.sh
Note: This step will ask you to enter your system password
4. Run the file using the below command
./install_git.sh
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