AI Hints
Home›Git & GitHub Tutorial›Your First Repository
Git & GitHub · Lesson 4 of 144

Telling Git Who You Are

Your name and email.

⏱ 2 min read▶ Video at 3:28🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Every commit records who made it. So before your first commit, you tell Git your name and your email. You only do this once, on each computer.

Telling Git Who You Are
From the video: Telling Git Who You Are
  • Every commit records an author
  • Set your name and email
  • Once per computer

git config

We use git config, with dash dash global, which means for every project on this computer. First the user name, in quotes. Then the user email. Git prints nothing, which means it worked. To check, we list the settings, with config dash dash list. There they are, your name and your email.

git
git config --global user.name "Sam Lee"
git config --global user.email "sam@example.com"
git config --global --list
user.name=Sam Lee
user.email=sam@example.com

Good to know

A few tips. Use the same email you'll use on GitHub later, so your commits link to your account. Silence is good news in Git. Many commands print nothing when they succeed. And you can change these settings at any time, by running the same command again.

Same emailas your GitHub account
No outputusually means success
Change laterjust run it again
--globalfor every project

Summary

git config sets your name and email, once per computer. Next, your very first Git project.

Key takeaways
  • git config --global user.name
  • git config --global user.email
  • Silence means success
Next up: Your First Repository — git init