Documentation: git-init: template directory: reword
[alt-git.git] / Documentation / git-init.txt
blob6ffe721ecc7da3a03ec1fc7ae4d358a100c1574c
1 git-init(1)
2 ===========
4 NAME
5 ----
6 git-init - Create an empty Git repository or reinitialize an existing one
9 SYNOPSIS
10 --------
11 [verse]
12 'git init' [-q | --quiet] [--bare] [--template=<template_directory>]
13           [--separate-git-dir <git dir>]
14           [--shared[=<permissions>]] [directory]
17 DESCRIPTION
18 -----------
20 This command creates an empty Git repository - basically a `.git`
21 directory with subdirectories for `objects`, `refs/heads`,
22 `refs/tags`, and template files.  An initial `HEAD` file that
23 references the HEAD of the master branch is also created.
25 If the `$GIT_DIR` environment variable is set then it specifies a path
26 to use instead of `./.git` for the base of the repository.
28 If the object storage directory is specified via the
29 `$GIT_OBJECT_DIRECTORY` environment variable then the sha1 directories
30 are created underneath - otherwise the default `$GIT_DIR/objects`
31 directory is used.
33 Running 'git init' in an existing repository is safe. It will not
34 overwrite things that are already there. The primary reason for
35 rerunning 'git init' is to pick up newly added templates (or to move
36 the repository to another place if --separate-git-dir is given).
38 OPTIONS
39 -------
43 -q::
44 --quiet::
46 Only print error and warning messages; all other output will be suppressed.
48 --bare::
50 Create a bare repository. If GIT_DIR environment is not set, it is set to the
51 current working directory.
53 --template=<template_directory>::
55 Specify the directory from which templates will be used.  (See the "TEMPLATE
56 DIRECTORY" section below.)
58 --separate-git-dir=<git dir>::
60 Instead of initializing the repository where it is supposed to be,
61 place a filesytem-agnostic Git symbolic link there, pointing to the
62 specified path, and initialize a Git repository at the path. The
63 result is Git repository can be separated from working tree. If this
64 is reinitialization, the repository will be moved to the specified
65 path.
67 --shared[=(false|true|umask|group|all|world|everybody|0xxx)]::
69 Specify that the Git repository is to be shared amongst several users.  This
70 allows users belonging to the same group to push into that
71 repository.  When specified, the config variable "core.sharedRepository" is
72 set so that files and directories under `$GIT_DIR` are created with the
73 requested permissions.  When not specified, Git will use permissions reported
74 by umask(2).
76 The option can have the following values, defaulting to 'group' if no value
77 is given:
80 'umask' (or 'false')::
82 Use permissions reported by umask(2). The default, when `--shared` is not
83 specified.
85 'group' (or 'true')::
87 Make the repository group-writable, (and g+sx, since the git group may be not
88 the primary group of all users). This is used to loosen the permissions of an
89 otherwise safe umask(2) value. Note that the umask still applies to the other
90 permission bits (e.g. if umask is '0022', using 'group' will not remove read
91 privileges from other (non-group) users). See '0xxx' for how to exactly specify
92 the repository permissions.
94 'all' (or 'world' or 'everybody')::
96 Same as 'group', but make the repository readable by all users.
98 '0xxx'::
100 '0xxx' is an octal number and each file will have mode '0xxx'. '0xxx' will
101 override users' umask(2) value (and not only loosen permissions as 'group' and
102 'all' does). '0640' will create a repository which is group-readable, but not
103 group-writable or accessible to others. '0660' will create a repo that is
104 readable and writable to the current user and group, but inaccessible to others.
107 By default, the configuration flag `receive.denyNonFastForwards` is enabled
108 in shared repositories, so that you cannot force a non fast-forwarding push
109 into it.
111 If you name a (possibly non-existent) directory at the end of the command
112 line, the command is run inside the directory (possibly after creating it).
116 TEMPLATE DIRECTORY
117 ------------------
119 The template directory contains files and directories that will be copied to
120 the `$GIT_DIR` after it is created.
122 The template directory will be one of the following (in order):
124  - the argument given with the `--template` option;
126  - the contents of the `$GIT_TEMPLATE_DIR` environment variable;
128  - the `init.templatedir` configuration variable; or
130  - the default template directory: `/usr/share/git-core/templates`.
132 The default template directory includes some directory structure, some
133 suggested "exclude patterns", and copies of sample "hook" files.
134 The suggested patterns and hook files are all modifiable and extensible.
136 EXAMPLES
137 --------
139 Start a new Git repository for an existing code base::
141 ----------------
142 $ cd /path/to/my/codebase
143 $ git init      <1>
144 $ git add .     <2>
145 ----------------
147 <1> Create a /path/to/my/codebase/.git directory.
148 <2> Add all existing files to the index.
152 Part of the linkgit:git[1] suite