When you start using Git in a new computer you need to setup some basic steps to configure Git for the first time, and to be ready to work in a git console.
Install Git
The install process could be different for each OS. However, here is a list of the most common operating system installation steps:
- MacOS:
- Install via HomeBrew (
brew install git)
- Install via MacPorts (
sudo port install git
) - Go to https://git-scm.com/download/mac and install the package manually
- Install via HomeBrew (
- Linux
- Debian/Ubuntu (sudo apt-get install git)
- CentOS (sudo yum install git)
- Fedora (sudo yum install git-core)
- Windows
- Go to https://git-scm.com/download/win and install the package manually.
Usage
After installing GIT you will get a set of tools depending on your operating system:
- The GIT command-line interface: you can enter from your console application, and then run
git
commands from there. - Git Bash: for Windows users, it’s a Linux-like terminal with access to git commands in a more standard way (for example, to run
npm
commands) - A Git GUI: for Windows users, it’s a visual interface to perform GIT operations.
Configure Git for the first time
Before running some git commands for the first time, for example, to commit and push changes to a repository, it’s important to configure a couple of global variables used for those transactions. Otherwise, you could get some warning messages about this.
Global variables
- Set the git global user name (
git config --global user.name "myname"
) - Set the git global email (
git config --global user.email "my@email.com"
)
Related articles
Useful GIT commands for everyday use