1GIT-INIT(1)                       Git Manual                       GIT-INIT(1)
2
3
4

NAME

6       git-init - Create an empty git repository or reinitialize an existing
7       one
8

SYNOPSIS

10       git init [-q | --quiet] [--bare] [--template=<template_directory>]
11       [--shared[=<permissions>]] [directory]
12

OPTIONS

14       -q, --quiet
15           Only print error and warning messages, all other output will be
16           suppressed.
17
18       --bare
19           Create a bare repository. If GIT_DIR environment is not set, it is
20           set to the current working directory.
21
22       --template=<template_directory>
23           Specify the directory from which templates will be used. (See the
24           "TEMPLATE DIRECTORY" section below.)
25
26       --shared[=(false|true|umask|group|all|world|everybody|0xxx)]
27           Specify that the git repository is to be shared amongst several
28           users. This allows users belonging to the same group to push into
29           that repository. When specified, the config variable
30           "core.sharedRepository" is set so that files and directories under
31           $GIT_DIR are created with the requested permissions. When not
32           specified, git will use permissions reported by umask(2).
33
34       The option can have the following values, defaulting to group if no
35       value is given:
36
37       ·    umask (or false): Use permissions reported by umask(2). The
38           default, when --shared is not specified.
39
40       ·    group (or true): Make the repository group-writable, (and g+sx,
41           since the git group may be not the primary group of all users).
42           This is used to loosen the permissions of an otherwise safe
43           umask(2) value. Note that the umask still applies to the other
44           permission bits (e.g. if umask is 0022, using group will not remove
45           read privileges from other (non-group) users). See 0xxx for how to
46           exactly specify the repository permissions.
47
48       ·    all (or world or everybody): Same as group, but make the
49           repository readable by all users.
50
51       ·    0xxx: 0xxx is an octal number and each file will have mode 0xxx.
52           0xxx will override users' umask(2) value (and not only loosen
53           permissions as group and all does).  0640 will create a repository
54           which is group-readable, but not group-writable or accessible to
55           others.  0660 will create a repo that is readable and writable to
56           the current user and group, but inaccessible to others.
57
58       By default, the configuration flag receive.denyNonFastForwards is
59       enabled in shared repositories, so that you cannot force a non
60       fast-forwarding push into it.
61
62       If you name a (possibly non-existent) directory at the end of the
63       command line, the command is run inside the directory (possibly after
64       creating it).
65

DESCRIPTION

67       This command creates an empty git repository - basically a .git
68       directory with subdirectories for objects, refs/heads, refs/tags, and
69       template files. An initial HEAD file that references the HEAD of the
70       master branch is also created.
71
72       If the $GIT_DIR environment variable is set then it specifies a path to
73       use instead of ./.git for the base of the repository.
74
75       If the object storage directory is specified via the
76       $GIT_OBJECT_DIRECTORY environment variable then the sha1 directories
77       are created underneath - otherwise the default $GIT_DIR/objects
78       directory is used.
79
80       Running git init in an existing repository is safe. It will not
81       overwrite things that are already there. The primary reason for
82       rerunning git init is to pick up newly added templates.
83
84       Note that git init is the same as git init-db. The command was
85       primarily meant to initialize the object database, but over time it has
86       become responsible for setting up the other aspects of the repository,
87       such as installing the default hooks and setting the configuration
88       variables. The old name is retained for backward compatibility reasons.
89

TEMPLATE DIRECTORY

91       The template directory contains files and directories that will be
92       copied to the $GIT_DIR after it is created.
93
94       The template directory used will (in order):
95
96       ·   The argument given with the --template option.
97
98       ·   The contents of the $GIT_TEMPLATE_DIR environment variable.
99
100       ·   The init.templatedir configuration variable.
101
102       ·   The default template directory: /usr/share/git-core/templates.
103
104       The default template directory includes some directory structure, some
105       suggested "exclude patterns", and copies of sample "hook" files. The
106       suggested patterns and hook files are all modifiable and extensible.
107

EXAMPLES

109       Start a new git repository for an existing code base
110
111               $ cd /path/to/my/codebase
112               $ git init      (1)
113               $ git add .     (2)
114
115           1. prepare /path/to/my/codebase/.git directory
116           2. add all existing file to the index
117

AUTHOR

119       Written by Linus Torvalds <torvalds@osdl.org[1]>
120

DOCUMENTATION

122       Documentation by David Greaves, Junio C Hamano and the git-list
123       <git@vger.kernel.org[2]>.
124

GIT

126       Part of the git(1) suite
127

NOTES

129        1. torvalds@osdl.org
130           mailto:torvalds@osdl.org
131
132        2. git@vger.kernel.org
133           mailto:git@vger.kernel.org
134
135
136
137Git 1.7.4.4                       04/11/2011                       GIT-INIT(1)
Impressum