git init creates a repository; git config tells git who you are and how it should behave. Both are one-time work per project — and doing them deliberately prevents the most common first-day failures: commits with the wrong author, files tracked that never should have been, and a history nobody can navigate.

Creating the repository #

Start tracking a project
$ cd aospix-site
$ git init
Initialized empty Git repository in .../aospix-site/.git/
$ git status
On branch main
No commits yet
nothing to commit (create/copy files and use git add to track)

Everything git knows lives in the .git/ directory — deleting it is deleting the history, nothing else. git init also works on an existing directory, which is the usual case: start tracking work that already exists.

Identity: name and email #

Every commit is signed with a name and email, taken from config at commit time:

Set identity once per machine
$ git config --global user.name "Aospix Team"
$ git config --global user.email "team@aospix.com"

The three scopes, from narrow to wide: --local (this repo, stored in .git/config), --global (you, ~/.gitconfig), --system. Work identity differing from personal is the classic reason to set a local override. See exactly what applies with git config --list --show-origin.

The rest of first-day config #

SettingWhy
init.defaultBranch mainNew repos start on main, not master
pull.rebase truePulls rebase instead of merging
core.editorCommit messages open in your editor
core.excludesfileGlobal ignore rules, e.g. .DS_Store
A sensible global baseline
$ git config --global init.defaultBranch main
$ git config --global pull.rebase true
$ git config --global core.editor "code --wait"

The first commit that matters #

Before the first git add, write the .gitignore — node_modules, build output, secrets. The first commit is cheap; un-tracking a committed secret is not:

The first commit
$ git add .gitignore README.md src/
$ git commit -m "Initial commit: site skeleton"
$ git log --oneline
a1b2c3d Initial commit: site skeleton

From here the natural order is cloning, reading history with status and log, and making commits worth reading. The Git series covers the whole path.