Guide

Start a Git repository

Choose between initializing a directory you already have and cloning an existing repository before recording changes with Git.

At a glance

Start locally
git init
Copy a repository
git clone

Overview

There are two common starting points for Git: place an existing directory under version control, or copy an existing repository. Initialization creates the repository metadata in your directory. Cloning retrieves an existing project's repository and a working copy of its files.

Initialize an existing directory

Open a terminal in the project directory and run git init. This creates Git's metadata directory. It does not immediately record every file: select the files you want with git add, then create an initial commit.

Clone an existing project

Use git clone followed by the repository URL supplied by the project. Git creates a directory containing the repository and checked-out files. Enter that directory before starting work, and consult the project's own setup instructions for dependencies.

Sources and review

MOOR's explanatory text is supported by the following source links.

  1. Getting a Git Repository — Pro Git
  2. Start a Git repository: supporting documentation — Pro Git

Browse MOOR Knowledge