How to Configure Your Global Git Config Settings |Video upload date:  · Duration: PT6M56S  · Language: EN

Quick guide to set global Git config options like user name email default editor and signing keys so every repository behaves consistently

Why bother with a global Git config

Think of global Git config as the ID badge your commits wear across every repo on your machine. Set it once and avoid the chaos of commit records that look like they were made by random internet avatars. This short git tutorial covers identity editor and signing so your history stays readable and trustworthy.

Quick audit of current settings

Before you start changing things in a panic run the basic check to see what is already set in global git config. This helps you avoid surprising yourself later.

git config --global --list

If you see unexpected values that probably explains why old commits looked like they came from someone called Unknown Developer.

Set your user name and email

These values show up in commit metadata and on services like GitHub. Pick a sensible user.name and an email to match the account you want commits attributed to.

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

Use the same public email across devices for shared projects to avoid split author histories. For private work use a different email so you can be mysterious in peace.

Pick a default editor

Git needs an editor when you do interactive rebase or forget to pass a message with commit. Set one you actually know how to close.

git config --global core.editor "code --wait"
# or for the minimalists
git config --global core.editor "nano"

Enable GPG signing for proof of authorship

If you want to prove commits are really yours enable signing. Find your key and tell git about it.

gpg --list-secret-keys --keyid-format LONG
# note your key id then
git config --global user.signingkey YOURKEY
git config --global commit.gpgsign true

Signing adds a tiny bit of friction and a lot of confidence that the commit came from you and not from a CI job with attitude.

List verify and edit the global config

Confirm changes with the list command and edit directly when you need more control.

git config --global --list
git config --global --edit

The global file lives at ~/.gitconfig. Open it if you like hand editing or need to copy settings to a new machine.

Common pitfalls and tips

  • Do not mix up local and global identity values or your commit attribution will look like it has multiple personalities
  • If a repo has a local config it overrides the global config so check both places when troubleshooting
  • Keep your public projects on one email to avoid fragmented contribution graphs
  • Enable GPG signing for important work to add a layer of authorship proof

Final checklist before you push anything

  1. Run git config --global --list and confirm your name and email
  2. Set core.editor so messages and rebases stop being an adventure
  3. Enable signing if you need verified commits
  4. Keep a note of your ~/.gitconfig so cloning a new machine is not a scavenger hunt

If you follow these steps your command line git experience will be less chaotic and more predictable. That is a low bar but very satisfying to clear.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.