How to Initialize a New Git Repository (git init)

git init creates a new, empty Git repository in the current directory by adding a hidden .git folder that stores all version history.

Published September 26, 2026

git init creates a new, empty Git repository in the current directory by adding a hidden .git folder that stores all version history.

Key points

  • Run it once inside a project folder to start tracking it with Git
  • Creates a .git directory containing the object database, refs, and configuration for that repository
  • git init --bare creates a repository with no working directory, meant to be a shared remote rather than edited directly

Example

git init
More Git articles