Useful Git config settings to check on a new machine

Posted: (EET/GMT+2)

 

When setting up Git on a new machine, a few git config settings are worth checking right away.

These control how your commits look, how credentials are handled, and how Git behaves in common situations.

Start with identity. These values are written into every commit:

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

If these are missing or incorrect, you cannot either create commits at all, or your commits may not be attributed to you correctly.

If you use multiple accounts, you can also override the username per repository:

git config credential.username your-username

This is useful when working with different GitHub or Azure DevOps accounts on the same machine.

Next, line endings. This helps avoid unnecessary diffs between Windows and Unix systems:

git config --global core.autocrlf true

On Windows, this setting converts line endings automatically. Adjust as needed if you work in a mixed environment.

Another useful setting is the default branch name:

git config --global init.defaultBranch main

This ensures new repositories use main instead of master.

You can also enable a credential helper so you do not have to enter credentials repeatedly:

git config --global credential.helper manager

On Windows, this uses Git Credential Manager to securely store credentials.

A few more small but handy options:

git config --global core.editor "notepad"
git config --global pull.rebase false
git config --global fetch.prune true

These control the default editor, pull behavior, and cleanup of deleted remote branches.

To review your current configuration:

git config --list

And to see where a value is coming from:

git config --show-origin --get user.name

So the practical takeaway is simple: set your identity, check credentials, and configure a few defaults early. It avoids confusion later when working across multiple repositories and accounts.