Updated git_doc to git 1.8
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-init.xml
blob138a3c279d6057db315f76b7601bb8d3dfb945bc
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <sect2 lang="en" id="git-init(1)">\r
5     <title>git-init(1)</title>\r
6 <indexterm>\r
7 <primary>git-init(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-init(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-init - Create an empty git repository or reinitialize an existing one</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-init(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout><emphasis>git init</emphasis> [-q | --quiet] [--bare] [--template=&lt;template_directory&gt;]\r
17           [--separate-git-dir &lt;git dir&gt;]\r
18           [--shared[=&lt;permissions&gt;]] [directory]</literallayout>\r
19 </blockquote>\r
20 </simplesect>\r
21 <simplesect id="git-init(1)__description">\r
22 <title>DESCRIPTION</title>\r
23 <simpara>This command creates an empty git repository - basically a <emphasis>.git</emphasis>\r
24 directory with subdirectories for <emphasis>objects</emphasis>, <emphasis>refs/heads</emphasis>,\r
25 <emphasis>refs/tags</emphasis>, and template files.  An initial <emphasis>HEAD</emphasis> file that\r
26 references the HEAD of the master branch is also created.</simpara>\r
27 <simpara>If the <emphasis>$GIT_DIR</emphasis> environment variable is set then it specifies a path\r
28 to use instead of <emphasis>./.git</emphasis> for the base of the repository.</simpara>\r
29 <simpara>If the object storage directory is specified via the\r
30 <emphasis>$GIT_OBJECT_DIRECTORY</emphasis> environment variable then the sha1 directories\r
31 are created underneath - otherwise the default <emphasis>$GIT_DIR/objects</emphasis>\r
32 directory is used.</simpara>\r
33 <simpara>Running <emphasis>git init</emphasis> in an existing repository is safe. It will not\r
34 overwrite things that are already there. The primary reason for\r
35 rerunning <emphasis>git init</emphasis> is to pick up newly added templates (or to move\r
36 the repository to another place if --separate-git-dir is given).</simpara>\r
37 </simplesect>\r
38 <simplesect id="git-init(1)__options">\r
39 <title>OPTIONS</title>\r
40 <variablelist>\r
41 <varlistentry>\r
42 <term>\r
43 -q\r
44 </term>\r
45 <term>\r
46 --quiet\r
47 </term>\r
48 <listitem>\r
49 <simpara>\r
50 Only print error and warning messages, all other output will be suppressed.\r
51 </simpara>\r
52 </listitem>\r
53 </varlistentry>\r
54 <varlistentry>\r
55 <term>\r
56 --bare\r
57 </term>\r
58 <listitem>\r
59 <simpara>\r
60 Create a bare repository. If GIT_DIR environment is not set, it is set to the\r
61 current working directory.\r
62 </simpara>\r
63 </listitem>\r
64 </varlistentry>\r
65 <varlistentry>\r
66 <term>\r
67 --template=&lt;template_directory&gt;\r
68 </term>\r
69 <listitem>\r
70 <simpara>\r
71 Specify the directory from which templates will be used.  (See the "TEMPLATE\r
72 DIRECTORY" section below.)\r
73 </simpara>\r
74 </listitem>\r
75 </varlistentry>\r
76 <varlistentry>\r
77 <term>\r
78 --separate-git-dir=&lt;git dir&gt;\r
79 </term>\r
80 <listitem>\r
81 <simpara>\r
82 Instead of initializing the repository where it is supposed to be,\r
83 place a filesytem-agnostic git symbolic link there, pointing to the\r
84 specified git path, and initialize a git repository at the path. The\r
85 result is git repository can be separated from working tree. If this\r
86 is reinitialization, the repository will be moved to the specified\r
87 path.\r
88 </simpara>\r
89 </listitem>\r
90 </varlistentry>\r
91 <varlistentry>\r
92 <term>\r
93 --shared[=(false|true|umask|group|all|world|everybody|0xxx)]\r
94 </term>\r
95 <listitem>\r
96 <simpara>\r
97 Specify that the git repository is to be shared amongst several users.  This\r
98 allows users belonging to the same group to push into that\r
99 repository.  When specified, the config variable "core.sharedRepository" is\r
100 set so that files and directories under <emphasis>$GIT_DIR</emphasis> are created with the\r
101 requested permissions.  When not specified, git will use permissions reported\r
102 by umask(2).\r
103 </simpara>\r
104 </listitem>\r
105 </varlistentry>\r
106 </variablelist>\r
107 <simpara>The option can have the following values, defaulting to <emphasis>group</emphasis> if no value\r
108 is given:</simpara>\r
109 <itemizedlist>\r
110 <listitem>\r
111 <simpara>\r
112 <emphasis>umask</emphasis> (or <emphasis>false</emphasis>): Use permissions reported by umask(2). The default,\r
113    when <emphasis>--shared</emphasis> is not specified.\r
114 </simpara>\r
115 </listitem>\r
116 <listitem>\r
117 <simpara>\r
118 <emphasis>group</emphasis> (or <emphasis>true</emphasis>): Make the repository group-writable, (and g+sx, since\r
119    the git group may be not the primary group of all users).\r
120    This is used to loosen the permissions of an otherwise safe umask(2) value.\r
121    Note that the umask still applies to the other permission bits (e.g. if\r
122    umask is <emphasis>0022</emphasis>, using <emphasis>group</emphasis> will not remove read privileges from other\r
123    (non-group) users). See <emphasis>0xxx</emphasis> for how to exactly specify the repository\r
124    permissions.\r
125 </simpara>\r
126 </listitem>\r
127 <listitem>\r
128 <simpara>\r
129 <emphasis>all</emphasis> (or <emphasis>world</emphasis> or <emphasis>everybody</emphasis>): Same as <emphasis>group</emphasis>, but make the repository\r
130    readable by all users.\r
131 </simpara>\r
132 </listitem>\r
133 <listitem>\r
134 <simpara>\r
135 <emphasis>0xxx</emphasis>: <emphasis>0xxx</emphasis> is an octal number and each file will have mode <emphasis>0xxx</emphasis>.\r
136    <emphasis>0xxx</emphasis> will override users' umask(2) value (and not only loosen permissions\r
137    as <emphasis>group</emphasis> and <emphasis>all</emphasis> does). <emphasis>0640</emphasis> will create a repository which is\r
138    group-readable, but not group-writable or accessible to others. <emphasis>0660</emphasis> will\r
139    create a repo that is readable and writable to the current user and group,\r
140    but inaccessible to others.\r
141 </simpara>\r
142 </listitem>\r
143 </itemizedlist>\r
144 <simpara>By default, the configuration flag receive.denyNonFastForwards is enabled\r
145 in shared repositories, so that you cannot force a non fast-forwarding push\r
146 into it.</simpara>\r
147 <simpara>If you name a (possibly non-existent) directory at the end of the command\r
148 line, the command is run inside the directory (possibly after creating it).</simpara>\r
149 </simplesect>\r
150 <simplesect id="git-init(1)__template_directory">\r
151 <title>TEMPLATE DIRECTORY</title>\r
152 <simpara>The template directory contains files and directories that will be copied to\r
153 the <emphasis>$GIT_DIR</emphasis> after it is created.</simpara>\r
154 <simpara>The template directory used will (in order):</simpara>\r
155 <itemizedlist>\r
156 <listitem>\r
157 <simpara>\r
158 The argument given with the <emphasis>--template</emphasis> option.\r
159 </simpara>\r
160 </listitem>\r
161 <listitem>\r
162 <simpara>\r
163 The contents of the <emphasis>$GIT_TEMPLATE_DIR</emphasis> environment variable.\r
164 </simpara>\r
165 </listitem>\r
166 <listitem>\r
167 <simpara>\r
168 The <emphasis>init.templatedir</emphasis> configuration variable.\r
169 </simpara>\r
170 </listitem>\r
171 <listitem>\r
172 <simpara>\r
173 The default template directory: <emphasis>/usr/share/git-core/templates</emphasis>.\r
174 </simpara>\r
175 </listitem>\r
176 </itemizedlist>\r
177 <simpara>The default template directory includes some directory structure, some\r
178 suggested "exclude patterns", and copies of sample "hook" files.\r
179 The suggested patterns and hook files are all modifiable and extensible.</simpara>\r
180 </simplesect>\r
181 <simplesect id="git-init(1)__examples">\r
182 <title>EXAMPLES</title>\r
183 <variablelist>\r
184 <varlistentry>\r
185 <term>\r
186 Start a new git repository for an existing code base\r
187 </term>\r
188 <listitem>\r
189 <screen>$ cd /path/to/my/codebase\r
190 $ git init      <co id="git-init_CO1-1"/>\r
191 $ git add .     <co id="git-init_CO1-2"/></screen>\r
192 <calloutlist>\r
193 <callout arearefs="git-init_CO1-1">\r
194 <para>\r
195 prepare /path/to/my/codebase/.git directory\r
196 </para>\r
197 </callout>\r
198 <callout arearefs="git-init_CO1-2">\r
199 <para>\r
200 add all existing file to the index\r
201 </para>\r
202 </callout>\r
203 </calloutlist>\r
204 </listitem>\r
205 </varlistentry>\r
206 </variablelist>\r
207 </simplesect>\r
208 <simplesect id="git-init(1)__git">\r
209 <title>GIT</title>\r
210 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
211 </simplesect>\r
212 </sect2>\r