How to Set Up Git?
Tags: github, git, setup, beginners
Published: 2021-12-01 12:30:39

Hello 👋 good people. In this blog post, we will learn how to set up Git on your local computer. ***Because Git is responsible for everything GitHub-related that happens locally on your computer.***

Those who don't know what Git & GitHub is, kindly read this post to know about Git & GitHub  [Introduction to Git & GitHub for Beginners](https://syedsohan.hashnode.dev/introduction-to-git-and-github-for-beginners).

## Table of contents

1. [Download and Install Git](#download-and-install-git)

2. [Set your Git username Globally](#set-your-git-username-globally)

3. [Set your Git username for a Single Repository](#set-your-git-username-for-a-single-repository)

4. [Set your email globally](#set-your-email-globally)

5. [Set your email for a single repository](#set-your-email-for-a-single-repository)


### Download and Install Git

To download & install **Git** just go to this following  [page](https://git-scm.com/downloads)  and download Git for your preferable OS (**macOS, Windows, Linux/Unix**).


![Git-Logo-1788C.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638359186182/VGGJJPy9t.png)

### Set your Git username Globally

You can change the name that is associated with your Git commits using the `git config` command. The new name you set will be visible in any future commits you push to GitHub from the command line.

- Open Git Bash.

- Set your Git username


```bash
$ git config --global user.name "John Doe"

``` 

- Recheck that you've given the right username


```bash
$ git config --global user.name
> John Doe
```

### Set your Git username for a Single Repository

- Open Git Bash.

- Change the current working directory to the local repository where you want to configure the name that is associated with your Git commits.

- Set your Git username

```bash
$ git config user.name "John Doe"

```

- Recheck that you've given the right username

```bash
$ git config user.name
> John Doe
```

### Set your email globally

- Open Git Bash.

- Set your email address in Git. You can use your **GitHub-provided `no-reply`** (if you change your email public to private in GitHub) email address or any email address.

```bash
$ git config --global user.email "email@example.com"
```
- Recheck that you've given the right email

```bash
$ git config --global user.email
> email@example.com
```

### Set your email for a single repository

- Open Git Bash.

- Change the current working directory to the local repository where you want to configure the email address that is associated with your Git commits.

- Set your email address in Git. You can use your **GitHub-provided `no-reply`** (if you change your email public to private in GitHub) email address or any email address.

```bash
git config user.email "email@example.com"

```

- Recheck that you've given the right email

```bash
$ git config user.email
> email@example.com
```

> 
**Thanks for reading this post. Stay tuned for more.**


> 
**You can find me [here](https://bio.link/syedsohan)  also.**

<a href="https://www.buymeacoffee.com/syedsohan" target="_blank"><center><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;"></center></a>