Installation & Configuration
Feedback welcome: hello@simplegitcourse.com
Installing Git
Note that its core, Git is a free, command line application, available for macOS, Windows and Linux. We’ll cover the steps required to install Git in this section for each of these operating systems.
What is a CLI?
First, a bit about “command line interfaces” or CLIs. A command line is a way to run a program installed on your computer without using anything visual, such as buttons, etc.
So a CLI is just a blank screen where you can type commands and interact with programs installed on your computer. macOS, Windows and Linux all have some kind of terminal program pre-installed. Even today, terminals are frequently used by engineers to quickly perform common tasks.
If you’ve ever seen an action movie about “hackers”, you see them feverishly typing commands into a black screen, typically with cryptic green or text white everywhere. That’s basically an exaggeration of a command line interface (CLI).
Typically, you’ll use a "graphical user interface" or GUI instead of a CLI to interact with programs. An example of a GUI is say, a web browser, because it has visual elements you can click to interact with the program.
But for programming and for the sake of being able to enter commands quickly, a CLI is much more preferred by engineers than to make things much more user friendly. I will say that there are some GUIs for Git but those are only helpful once you have a basic understanding of Git.
Throughout this course, we'll only use Git as a CLI application as it is the most popular among engineers. Don’t worry, I’ll ensure that you do not need prior experience with a CLI to learn Git. We'll cover the terminal skills you'll need to cover the course material. Read over and follow the directions carefully below depending on the operating system you use.
In the next section, we’ll cover the steps needed to install Git.
Installation on macOS
If you are using macOS, Git does not come pre-installed by default.
You’ll have to install it using what’s known as Apple’s Command Line Tools (also known as XCode CLTs), a free package catered to software engineers using macOS.
First, open the "Terminal" application on your mac and enter the following command:
xcode-select --install
This will prompt you to install the Command Line tools, including Git.
Installation on Windows
For Windows users, a free program called Git Bash will be required to follow the rest of this course. This is because Git Bash emulates a “Bash” CLI which is common for most software engineers, especially if they use macOS or Linux. This means that the commands required to perform common tasks, which we will do in this course, such as creating files, directories, navigating, will all be the same regardless of operating system.
So head over to git-scm.com and you’ll see “Download <version> for Windows”. Click to download it and install.
Please keep in mind that if you want to follow along with the commands used in this course, you must run the Git Bash Windows application to bring up a CLI.
Installation on Linux
Git is installed on most Linux distributions.
If on the very off chance that it is not, you’ll need to install Git using the default package manager that is installed on Linux. These directions can vary based on the Linux distribution and therefore will not be included in this course.
Confirming Installation
Based on the operating system you are using, open the CLI tool that is cited in the respective section you’ve followed above and verify that Git is installed and running by entering the following command and hitting the Enter key:
git --version
If you see the version of Git printed on the screen after running this, you are good to proceed. If not, go back to the directions about and carefully make sure you are not missing anything.
Configuring Git
You’ll want to configure Git now or else it may give you some annoying error messages later on in this course.
We’ll be entering some slightly complex commands next. If you are new to CLIs and/or programming, just make sure you are entering the commands carefully.
First, in the CLI that you’ve just confirmed where Git is working (in the previous section), enter the following command and hit the Enter key. Replace “Your Name” with your name before running this command.:
git config --global user.name "Your Name"
Now, run this next command. Replace “you@example.com” with any email you’d like:
git config --global user.email "you@example.com"
Now, any work you do using Git will include information about you. This will be important when you eventually collaborate with others using Git as well.
Chapter Recap
In this chapter, we’ve covered:
- Core Git concepts and example use cases.
- What a CLI is and basic use.
- Installation and configuration.
As you can see, Git is a powerful tool with use cases that are very common to everyday development. You should now have Git set up a ready to use along with the ability to open a basic CLI (terminal) and execute commands.
Next up: Let's Create Code