1git-init-db(1) 2============== 3 4NAME 5---- 6git-init-db - Creates an empty git repository 7 8 9SYNOPSIS 10-------- 11'git-init-db' [--template=<template_directory>] [--shared] 12 13 14OPTIONS 15------- 16--template=<template_directory>:: 17 Provide the directory in from which templates will be used. 18 19--shared:: 20 Specify that the git repository is to be shared amongst several users. 21 22 23DESCRIPTION 24----------- 25This simply creates an empty git repository - basically a `.git` directory 26and `.git/object/??/`, `.git/refs/heads` and `.git/refs/tags` directories, 27and links `.git/HEAD` symbolically to `.git/refs/heads/master`. 28 29If the `$GIT_DIR` environment variable is set then it specifies a path 30to use instead of `./.git` for the base of the repository. 31 32If the object storage directory is specified via the `$GIT_OBJECT_DIRECTORY` 33environment variable then the sha1 directories are created underneath - 34otherwise the default `$GIT_DIR/objects` directory is used. 35 36A shared repository allows users belonging to the same group to push into that 37repository. When specifying `--shared` the config variable "core.sharedRepository" 38is set to 'true' so that directories under `$GIT_DIR` are made group writable 39(and g+sx, since the git group may be not the primary group of all users). 40 41 42Running `git-init-db` in an existing repository is safe. It will not overwrite 43things that are already there. The primary reason for rerunning `git-init-db` 44is to pick up newly added templates. 45 46 47 48EXAMPLES 49-------- 50 51Start a new git repository for an existing code base:: 52+ 53---------------- 54$ cd /path/to/my/codebase 55$ git-init-db <1> 56$ git-add . <2> 57 58<1> prepare /path/to/my/codebase/.git directory 59<2> add all existing file to the index 60---------------- 61 62 63Author 64------ 65Written by Linus Torvalds <torvalds@osdl.org> 66 67Documentation 68-------------- 69Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. 70 71GIT 72--- 73Part of the gitlink:git[7] suite 74