Starting a Repo & Identity
Creating a Repository
Turn any folder into a Git repo with one command:
$ git init
Initialized empty Git repository in /home/labuser/project/.git/
This creates a hidden .git/ directory - the entire history lives there. Delete it and the folder becomes an ordinary directory again.
Before your first commit, tell Git who you are (it stamps every commit with this):
$ git config --global user.name "Your Name"
$ git config --global user.email "you@example.com"
| Command | Purpose |
|---|---|
git init | Start tracking the current folder |
git config --global user.name | Set your commit name |
git config --list | Show current config |
git clone <url> | Copy an existing remote repo |
Tip:--globalsets it for every repo on your machine. Drop--globalto override it for just one project (handy for work vs personal emails).
Try it below: git init a folder, then set a name and email.