Back
GitoryxGitoryx
Beginner8 min read

Git Config: How to Configure Git for Your Workflow

Before writing your first commit, Git needs to know who you are. git config controls everything from your identity to your preferred editor, merge strategy, and custom aliases. This guide covers local, global, and system-level configuration.

The Problem

Your commits show up with the wrong author name, or Git keeps opening a text editor you don't recognize. You've never configured Git and now things aren't working the way you expect.

Git's default settings are minimal by design. A few minutes of configuration — your name, email, default editor, and a handful of aliases — will save you hours of friction and make every commit properly attributed.

Common mistakes developers make with this:

  • Not setting user.name and user.email before making the first commit
  • Mixing up global and local config, ending up with the wrong email on work commits
  • Not knowing where the config file actually lives
  • Setting config values with typos that Git silently accepts

Gitoryx: Gitoryx reads your Git config automatically and displays your name and email in the commit panel — so you can verify your identity before every commit.

What is Config: How to Configure Git for Your Workflow?

`git config` reads and writes Git configuration values. Settings can be scoped to a single repository (local), your user account (global), or the entire system. Global settings live in `~/.gitconfig`.

Step-by-Step Guide

1

Set your name and email (global)

This is the first thing to do after installing Git. These values appear on every commit you make.

bash
git config --global user.name "Jane Doe"
git config --global user.email "jane@example.com"

Use the email address associated with your GitHub/GitLab account so contributions are linked to your profile.

2

Override config for a specific repository

Omit `--global` to set a value only for the current repo. Useful when you have a work laptop but also contribute to personal projects with a different email.

bash
cd ~/work/company-project
git config user.email "jane@company.com"
3

Set your default editor

Git opens a text editor when you write multi-line commit messages or run interactive rebase. Set it to your preferred editor.

bash
# VS Code
git config --global core.editor "code --wait"

# Vim
git config --global core.editor "vim"

# Nano
git config --global core.editor "nano"
4

Set the default branch name

Recent Git versions let you configure the initial branch name when creating new repos. Most teams use `main` now.

bash
git config --global init.defaultBranch main
See this workflow in Gitoryx — Gitoryx screenshot

See this workflow in Gitoryx. Reads your global and local user.name / user.email automatically

Free download
5

Create useful aliases

Aliases let you create shortcuts for long Git commands you type frequently.

bash
git config --global alias.st "status"
git config --global alias.lg "log --oneline --graph --decorate --all"
git config --global alias.undo "reset --soft HEAD~1"

# Usage:
git st
git lg

Store your aliases in your dotfiles to carry them across machines.

6

View and edit your config

List all active settings to verify your config, or open the file directly.

bash
# List all settings and their origin
git config --list --show-origin

# Open the global config in your editor
git config --global --edit

Common Mistakes to Avoid

Using a personal email on work commits

If you have one global email and you forget to set a repo-local one for work projects, your personal email ends up in company commit history.

Fix: Set `user.email` at the repo level for work projects, or use Git's `includeIf` to auto-apply a work config for all repos under a certain path.

Not configuring line endings

On Windows, Git may convert line endings (CRLF) in ways that produce diffs on every file even when nothing changed.

Fix: Set `git config --global core.autocrlf true` on Windows, or `input` on macOS/Linux.

Typos in config values

Git doesn't validate most config values, so a typo like `code --wai` will silently break your editor setting.

Fix: Test settings immediately after setting them, and use `git config --list` to double-check.

Gitoryx — visual Git client for macOS, Windows & Linux
GitoryxGitoryx — macOS, Windows & Linux

Gitoryx respects your Git config out of the box

  • Reads your global and local user.name / user.email automatically
  • Displays the commit author in the visual commit panel
  • No extra configuration needed — just install and open your repo
Download Gitoryx — FreemacOS · Windows · Linux · No subscription

Frequently Asked Questions

Where is the Git global config file located?

On macOS and Linux it's `~/.gitconfig`. On Windows it's usually `C:\Users\<YourName>\.gitconfig`. You can open it directly with `git config --global --edit`.

What is the difference between --global and --local config?

`--global` applies to all repositories for your user account. `--local` (the default) applies only to the current repository and is stored in `.git/config`. Local settings override global ones.

How do I check my current Git config?

Run `git config --list` to see all active settings. Add `--show-origin` to see which file each value comes from.

Can I use different emails for different projects automatically?

Yes. Use Git's `includeIf` directive in your global `~/.gitconfig` to automatically load a different config file for all repos under a specific directory path.

See it in action with Gitoryx

Everything in this tutorial is faster and clearer with a visual Git client. Gitoryx is free, runs natively on macOS, Windows, and Linux, and built for developers who want to move fast without breaking things.