1 year ago
We will start with updating and upgrading the packages that already exist on our system.
To update the packages, run this command with sudo:
sudo apt update
After this, all the packages will be updated. However, they still need to be upgraded. To do that, run the upgrade command with sudo as shown below:
sudo apt upgrade
This is how the terminal screen will appear after running the command:
Once all the packages are successfully upgraded, we will run a command to install Git.
This command will install Git:
sudo apt install git
After running the command, you will be informed that how much additional disk space will be used. It will use 38.4 MB of space. Type Y and hit enter to continue the installation process.
After the installation is completed, you need to check if git is now installed on your system or not. Run the git version command to verify if git exists. This will also tell you the version number of the git you just installed on your system.
If you don’t see the above output, it means the installation didn’t happen properly. Try to reinstall it following the previous steps. Also, make sure your internet connection is fine before you try installing it again.
Now that we have verified that Git software exists on our system, let’s now configure it. We will do it using the terminal.
Following the command syntax mentioned below, set a username that will be needed while committing changes on the Git repository.
git config --global user.name "Your name"
Next, set the user email that will also be required to commit changes on the Git repository. To do that, use this command syntax:
git config --global user.email “Your Email”
When you will run the command mentioned below, it will show you the username and email that you just set in the previous steps. Check carefully.
git config --list
In case you find an error like a spelling mistake or something else, you can correct it by editing the git configuration file.
To do that run the command below. We have used a nano editor to open the file. Once the file is open, correct the mistake and save the file.
sudo nano ~/.gitconfig