So far, we have been using Git to just download files from GitHub. In this section, we will go a bit further by setting up Git variables so we can start committing our files. I am going to use the same Ubuntu 16.04 host in the example. The installation process is well-documented; if you are using a different version of Linux or other operating systems, a quick search should land you at the right set of instructions.
If you have not done so already, install Git via the apt package-management tool:
$ sudo apt-get update
$ sudo apt-get install -y git
$ git --version
git version 2.7.4
Once git is installed, we need to configure a few things so our commit messages can contain the correct information:
$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"
$ git config --list
user.name=Your Name
[email protected]
Alternatively, you can modify the information in the ~/.gitconfig file:
$ cat ~/.gitconfig
[user]
name = Your Name
email = [email protected]
There are many other options in Git that we can change, but the name and email are the ones that allow us to commit the change without getting a warning. Personally, I like to use VIM, instead of the default Emac, as my text editor for typing commit messages:
(optional)
$ git config --global core.editor "vim"
$ git config --list
user.name=Your Name
[email protected]
core.editor=vim
Before we move on to using Git, let's go over the idea of a gitignore file.