How to Install & Configure Git¶
For Windows User¶
- You will need to install Git Bash for Windows.
- Just follow the installation instructions on the page and choose the default settings.
For macOS User¶
- Open Terminal app on your macOS.
-
Just copy and paste the following command in your terminal, then hit
enter
key, to check yourgit
version, it will prompt you to installGit
if you haven't already.git --version
For Linux (Ubuntu/Debian) User¶
- Check
Git
Installationgit --version
- If it is not already installed, use the following command in shell / terminal
sudo apt install git-all
For Linux (Fedora) User¶
- Check
Git
Installationgit --version
- If it is not already installed, use the following command in shell / terminal
sudo yum install git
Configure Git¶
From now onwards, the commands used in this workshop will be done in a terminal window (Windows: Git Bash, macOS: Terminal or whatever shell, Linux: Bash or whatever shell)
Setting up Git username and email address¶
Just letting Git
know who you are. If you already have a GitHub
account, keep the email address for your Git
at local same as your GitHub
email address.
- To check current username and email address for Git.
- It returns nothing if no name/email has been set.
git config --global user.name
git config --global user.email
- To set username and email address for Git.
--global
means to set for all the repositories on your machine.- If you only want to set for a single repository, do it without the
--global
flag.
git config --global user.name "Tom Cruise"
git config --global user.email "[email protected]"
Reference: - Getting Started - Installing Git