How to Create a Git Repository: git init

Git Tips & Commands

A Git repository (or repo for short) contains all of the project les and the entire revision history. You’ll take an ordinary folder of les (such as a website’s root folder), and tell Git to make it a repository. This creates a .git subfolder, which contains all of the Git metadata for tracking changes.

On Unix-based operating systems such as macOS, les and folders that start with a period (.) are hidden, so you will not see the .git folder in the macOS Finder unless you show hidden les, but it’s there! You might be able to see it in some
code editors.

TIP: On macOS you can show or hide invisible les by hitting Cmd–Shift-Period(.)

Initialize a Git Repo

  1. In your terminal (Terminal, Git Bash, or Windows Command Prompt), navigate to the folder you wish to make into a Git repo.

  2. Enter this command:

    git init

Go Beyond Git

We offer the best coding courses and bootcamps for students at all levels of experience. Classes are hands-on and students receive workbooks with step-by-step instructions through exercises with real-world applications. Check out our programming courses now:

How to Learn Git

Master Git with hands-on training. Git is a free, open-source version control system that allows developers to track the changes they make to code.

Yelp Facebook LinkedIn YouTube Twitter Instagram