Jump to content

Git/Overview/Creating

From Wikibooks, open books for an open world

Creating a local git repository is extremely simple. There are two commands that cover this functionality: git-init, and git-clone, because this is a single-developer overview git-clone is reserved for a later section.

Creating a git repository

[edit | edit source]

Creating a new git repository is simple, in the directory you want to track run git init. Or, if your playing around create a new directory.

mkdir mygit
cd mygit
git init

Git should immediately come back and tell you:

Initialized empty Git repository in .git/

The totality of your repository will be self-contained within the .git directory. Conversely, some SCMs leave droppings all over your working directory (ex, .svn, .cvs, .attic, etc.), git refrains, and puts all things in a subdirectory of the repository root aptly named .git.

Note: You may also want to create a bare repository which does not contain a copy of the working copy.