What is Git?
Git is a distributed version control system (VCS) which allows you to track your software at the source level. You can track changes, go back to preceding stages and also develop alternative version of files and directories.
Git Repository is used to maintain files by many projects. Websites such as GitHub and Bitbucket have made it easy to share and contribute to code. In this article, we will discuss how to install and configure git on an Ubuntu 16.04 system in 5 easy steps:-
- Running OS and package updates
- Install Git
- Confirm Git installation
- Configure Git’s settings (for the root user)
- Verify the Config changes
To execute this task, you must have a basic knowledge of Linux and shell command for Linux. To install Git on UBuntu 16.04 server, you require access to the root account. If you don’t have it, then you must add ‘sudo’ to the commands to get root privileges.
- You should be running a server with any Ubuntu 16.04 LTS series.
- You have to log in to SSH via the root user.
How To Install Git on Ubuntu 16.04 server?
Installing Git on Ubuntu with APT is quite simple as you can do it using Ubuntu’s default repositories. But its drawback is that the version downloaded is older than the newest version. If you want to install latest release, download git from source.
1. Running OS and package updates
The first step involves updating your local package index using apt package management tools.
2. Install Git
Next step involves downloading and installing the program. You may be asked to confirm the installation of Git. Simple type y to confirm.
sudo apt-get install git
3. Confirm Git installation
The third step involves confirming that the installed file us up and accessible. One of the best ways to do it is running Git with the version command.
git version 2.7.4
4. Configure Git’s settings (for the root user)
It’s crucial to setup your user account for Git at this stage to prevent any problems or errors in later stages.
We will set up the user123 with the email address [email protected]
git config –global user.name “user123”
git config –global user.email “[email protected]“
Note: Git configs functions on a user by user basis. Let us understand this with an example. If you have a ‘Josh’ linux user, then he should run the same commands from his user account. By doing this the commits made by the ‘Josh’ Linux user will be done under his details in Git.
5. Verify the Config changes
The last step involves verifying the configuration changes by viewing the .gitconfig file. I can be done using 2 ways:-
View the config file using cat with the following command:
View the config file using the git config command:
git config –list
You may also find this useful:- How To Modify Your Hosts Files On Windows, Mac And Ubuntu
Have other thoughts or questions? Reach out to us, our expert support is available 24*7 by phone or mail.
You can also open a chat with us and we’ll be happy to answer any questions you may have!