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