DEV Community

Allison Day
Allison Day

Posted on • Edited on • Originally published at sushicodes.com

12 Days of Gitmas: Setting up Git

On the second day of Gitmas, my mentee asked of me...
how do I get Git set up?
and could you explain Git, pretty please?

Welcome to the 12 Days of Gitmas!

On Day 1, I gave you a super simple intro to what Git is. Today's Day 2, where I'll be helping you install Git on your computer.

By default, your computer doesn't come with Git installed. Unfortunate, I know.

The simplest way to install Git is to go to the Git website and click the Download button, and then follow the provided instructions. Just go ahead with the default settings.

Screenshot of the Git website with an arrow pointing to the download button

Once you have Git installed, there are a couple more things you need to do to get Git running.

One of the benefits of using Git is that you can work with a lot of other people, and track everyone's changes. In order to do this, Git needs to be able to match the changes made to the project with the person who made those changes. In order to do that, you'll need to set a name and email that you'll "sign" your changes with.

First, open your terminal. If you're on a Mac, you can use the Terminal app that comes built-in, or download iTerm2 (which is what I use).

If you're on Windows, Git Bash will be installed when you install Git. Git Bash is a terminal emulator that allows you to access Git on Windows.

Once your terminal is open, type
git config --global user.email "YOUR EMAIL HERE"
but replace YOUR EMAIL HERE with your email address (keep the quotes), then hit enter. If you already have an account on GitHub or BitBucket, you should use that email (and if you don't know what those are, that's fine! We'll be discussing those in an upcoming post.)

When you hit enter, nothing should happen. That's as it should be!

Next, type
git config --global user.name "YOUR NAME HERE"
this time replacing YOUR NAME HERE with your name. Often, if you're working on a project with an employer or client, you should put your full name there. However, if you'd prefer to keep your identity private, you can write whatever you'd like there. Just keep in mind that this can be seen by others, so you may want to keep it at least somewhat professional.

Again, nothing will happen when you hit enter. However, there is a way to see if your changes worked:
git config --list --show-origin

This will show you where your .gitconfig file is located, as well as what the current settings are that you just set. If you know how, you can also go directly into your .gitconfig file and edit your settings there, too.

(If you're on mac and you get stuck here, type q to get out of this view.)

Screenshot of what I see with the git config --list command

Now you are set up to use git locally... which is what we'll be trying out in the next post!

Any questions about setting up Git? Did you run into any issues, or is something unclear? Let me know in the comments!

If you have any questions about Git or requests for other topics you'd like to see me blog about, please leave a comment! And if you're enjoying this series, consider supporting me on Patreon, following me on Twitter or checking out my Twitch streams!

Top comments (4)

Collapse
 
dennismusembi1 profile image
Dennis Mwendwa Musembi

Thanks for this

Collapse
 
sushicodes profile image
Allison Day

You're very welcome!

Collapse
 
capochiani profile image
Francesca Capochiani 🌺

Good work @sushicodes ! 🎄

Collapse
 
sushicodes profile image
Allison Day

Thank you!