## Setting your identity

Git records your name and email address with every [commit](/git/committing-file-changes). These should be set globally so they apply to all repositories on your machine. This is typically one of the first things you do after [installing Git](/git/install-git).

```
$ git config --global user.name "Your Name"
$ git config --global user.email "you@example.com"
```

### Override for a specific repository

Omitting `--global` writes the setting to the current repository only, overriding the global value for that repo.

```
$ git config user.email "work@example.com"
```

## Viewing configuration

### List all active settings

```
$ git config --list
```

### Read a single value

```
$ git config user.email
```

## Configuring your editor

```
$ git config --global core.editor "vim"
```

Other common values: `nano`, `code --wait` (VS Code), `subl -n -w` (Sublime Text).

## Setting the default branch name

```
$ git config --global init.defaultBranch main
```

## Configuring a remote URL

You can also set remote URLs through config, though [`git remote`](/git/commands/git-remote) is the more common approach for managing remote connections.

## Config file locations

| Scope | Flag | File location |
|---|---|---|
| System | `--system` | `/etc/gitconfig` |
| Global (user) | `--global` | `~/.gitconfig` |
| Local (repo) | *(none)* | `.git/config` |

Local settings always take precedence over global, which take precedence over system.

Once your code is ready, [DeployHQ](https://www.deployhq.com) can deploy it to your servers automatically from any Git repository.