Lesson 1.3. Setup and Your First Repository

Who is admin@MacBook-Pro.local?

That's roughly what a commit author can look like before Git is configured. GitHub won't be able to link such a commit to your profile, and the project history won't make it quite clear who made it. It's easy to fix: two commands — and every commit you make is signed with your name.

Goal

Configure Git and create or clone a repository.

Key concepts

  • Configuration levels: --system, --global, --local
  • user.name and user.email are written into every commit
  • git init creates a new repository
  • git clone copies an existing one along with its history

Commands / artifacts

BASH
git config --global user.name "Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
git init
git clone <url>

Common mistakes

SymptomCauseFix
Commits with someone else's or an empty authoruser.name / user.email not setconfigure them with --global, or --local for a project

Practice

Set your name and email, create a repository with git init, and clone any public repository.

git — Module 1. Git Basics

Interview Questions

git init creates a new empty repository in the current folder. git clone <url> copies an existing repository with its entire history and branches and sets up the origin remote right away.

At three levels: --system — for all users on the machine (/etc/gitconfig), --global — for your user (~/.gitconfig), --local — for one repository (.git/config). The closer level overrides the farther one: local → global → system. To see everything with its source: git config --list --show-origin.

Save your progress

Sign in or create a free account to mark lessons as completed and continue the whole course. You will come back to this lesson.