Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Git: Working with Git for the First Time

August 11, 2023 — Gregg Szumowski

Here’s the first step every user should start with after downloading and installing git but BEFORE doing anything else: Set up your global environment variables! If you don’t do this git will abort your commit and give you an annoying message like this one:

$ git commit file.txt
Author identity unknown

*** Please tell me who you are.

Run

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

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <user@localhost>) not allowed

You only should have to do the git config --global... commands one time. If you want to use a different user ID and email address in each repository then don’t include the --global parameter and it will only update your current repository leaving your global setting alone. If you’re contributing to different repositories using different email addresses or IDs then you definitely want to get into this habit.

Tags: cli, git, motd