Enter Your Email Address to Watch This Lesson

Your link to unlock this lesson will be sent to this email address.

Unlock this lesson and all 986 of the free egghead.io lessons, plus get JavaScript content delivered directly to your inbox!



Existing egghead members will not see this. Sign in.

How to install Git SCM

2:15 JavaScript lesson by

Let’s install the Git Source Control Management software so we can interact with repositories hosted on GitHub.


egghead.io comment guidelines

Avatar
egghead.io

Let’s install the Git Source Control Management software so we can interact with repositories hosted on GitHub.

Before we can start contributing to a project on GitHub, we need to set up Git on our local machine so that we can commit code and push it up to a repository. First, let's check if you have Git installed. Go to your terminal application and type git --version. If you get a version printed out here, then you are good to go. You have Git installed.

If you don't, then you're going to need to install Git. You can do this by going to git-scm.org. Here, you can download and install Git. If you're on a Windows machine, make sure you install Git with the BASH, because that's what you're going to be using to interact with Git. Once you have Git installed, you're going to want to configure it.

Go to your terminal and type, git --version to make sure that you have Git installed, and then we're going to want to configure it so that any time we make a commit, Git knows who to associate that commit with. We'll set this globally on this machine because I'm the only one who commits code on this machine. I'll say git config --global user.name and then your name. I'll say, Kent C. Dodds.

We'll do the same with git config --global user.email and then put our email, I'll say kent@doddsfamily.us.

Another thing that's good to set up when you're configuring Git is what's called a global .gitignore file. While coding, there are some files that you want to avoid adding to the repository because they're specific to your computer or they're generated files.

There's actually a GitHub project that we can use to get a good starter on our global .gitignore. If you go to github.com/github/gitignore, then there are a whole bunch of examples of .gitignores that you can use. By typing the T shortcut, you can search through all the files in the project.

We're going to go ahead and look for OS X, because that's the system that I'm running on. Here we can copy this into our global .gitignore file. We place that in our .gitignore file that is placed at our home directory. On my Mac, I'll CD into the home directory which is incidentally where I am now. You can use Vim or your favorite editor to open up the .gitignore_global file.

I already have mine in here. This is where you would put what you want to have for your global .gitignore.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?