Skip to content

Configure Git

Git stores an author name and email in each commit. Set them once globally, or omit --global to configure only the current repository.

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main

Check the resulting configuration:

git config --global --list

Use an email you control

If you want GitHub to associate commits with your account, use an email added to your GitHub account or GitHub's private noreply address.

Repository-specific settings

Run git config user.name "Project Name" inside a repository when that project needs a different identity.