# How to set up your global (and local) Git profile

> A quick note on setting the name, email and editor Git uses for your commits, globally or for one project.

- Date: 2022-08-16
- Tags: git, tutorial, devjournal
- Also on dev.to: [https://dev.to/jimzandueta/setup-your-git-profile-3i06](https://dev.to/jimzandueta/setup-your-git-profile-3i06)

Every new machine needs this before the first commit, and I always forget the exact commands. Here they are.

## Set up your Git profile

- Open your favorite terminal
- Set your Git username
```sh
$ git config --global user.name "Tony Stark"
```

- Set your Git email
```sh
$ git config --global user.email tonystark@avengers.com
```

- Set your Git editor (optional)
```sh
$ git config --global core.editor nano 
# you can also use emacs (nostalgic) or vim (adventurous). 
# If you don't set one, Git uses $EDITOR, or vi.
```

- Review your settings 
```sh
$ git config --list --show-origin
```

> The `--global` flag applies the settings to your user on this computer. To set them for one project only, go to the project's root folder (where the `.git` folder is) and run the same `git config` commands without `--global`, or with `--local` to be explicit.

### Resources
- [git config | Atlassian Git Tutorial ](https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-config)
- [Git - First-Time Git Setup ](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup)
