OSDN Git Service

merge original branch.
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseGit / git_doc / git-init.html.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-init(1)">\r
5 <articleinfo>\r
6     <title>git-init(1)</title>\r
7         <indexterm>\r
8                 <primary>git-init(1)</primary>\r
9         </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-init - Create an empty git repository or reinitialize an existing one</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <simpara><emphasis>git init</emphasis> [-q | --quiet] [--bare] [--template=&lt;template_directory&gt;] [--shared[=&lt;permissions&gt;]]</simpara>\r
18 </simplesect>\r
19 <simplesect id="_options">\r
20 <title>OPTIONS</title>\r
21 <variablelist>\r
22 <varlistentry>\r
23 <term>\r
24 -q\r
25 </term>\r
26 <term>\r
27 --quiet\r
28 </term>\r
29 <listitem>\r
30 <simpara>\r
31 Only print error and warning messages, all other output will be suppressed.\r
32 </simpara>\r
33 </listitem>\r
34 </varlistentry>\r
35 <varlistentry>\r
36 <term>\r
37 --bare\r
38 </term>\r
39 <listitem>\r
40 <simpara>\r
41 Create a bare repository. If GIT_DIR environment is not set, it is set to the\r
42 current working directory.\r
43 </simpara>\r
44 </listitem>\r
45 </varlistentry>\r
46 <varlistentry>\r
47 <term>\r
48 --template=&lt;template_directory&gt;\r
49 </term>\r
50 <listitem>\r
51 <simpara>\r
52 Provide the directory from which templates will be used.  The default template\r
53 directory is <literal>/usr/share/git-core/templates</literal>.\r
54 </simpara>\r
55 </listitem>\r
56 </varlistentry>\r
57 </variablelist>\r
58 <simpara>When specified, <literal>&lt;template_directory&gt;</literal> is used as the source of the template\r
59 files rather than the default.  The template files include some directory\r
60 structure, some suggested "exclude patterns", and copies of non-executing\r
61 "hook" files.  The suggested patterns and hook files are all modifiable and\r
62 extensible.</simpara>\r
63 <variablelist>\r
64 <varlistentry>\r
65 <term>\r
66 --shared[={false|true|umask|group|all|world|everybody|0xxx}]\r
67 </term>\r
68 <listitem>\r
69 <simpara>\r
70 Specify that the git repository is to be shared amongst several users.  This\r
71 allows users belonging to the same group to push into that\r
72 repository.  When specified, the config variable "core.sharedRepository" is\r
73 set so that files and directories under <literal>$GIT_DIR</literal> are created with the\r
74 requested permissions.  When not specified, git will use permissions reported\r
75 by umask(2).\r
76 </simpara>\r
77 </listitem>\r
78 </varlistentry>\r
79 </variablelist>\r
80 <simpara>The option can have the following values, defaulting to <emphasis>group</emphasis> if no value\r
81 is given:</simpara>\r
82 <itemizedlist>\r
83 <listitem>\r
84 <simpara>\r
85 <emphasis>umask</emphasis> (or <emphasis>false</emphasis>): Use permissions reported by umask(2). The default,\r
86    when <literal>--shared</literal> is not specified.\r
87 </simpara>\r
88 </listitem>\r
89 <listitem>\r
90 <simpara>\r
91 <emphasis>group</emphasis> (or <emphasis>true</emphasis>): Make the repository group-writable, (and g+sx, since\r
92    the git group may be not the primary group of all users).\r
93 </simpara>\r
94 </listitem>\r
95 <listitem>\r
96 <simpara>\r
97 <emphasis>all</emphasis> (or <emphasis>world</emphasis> or <emphasis>everybody</emphasis>): Same as <emphasis>group</emphasis>, but make the repository\r
98    readable by all users.\r
99 </simpara>\r
100 </listitem>\r
101 <listitem>\r
102 <simpara>\r
103 <emphasis>0xxx</emphasis>: <emphasis>0xxx</emphasis> is an octal number and each file will have mode <emphasis>0xxx</emphasis>\r
104    Any option except <emphasis>umask</emphasis> can be set using this option. <emphasis>0xxx</emphasis> will\r
105    override users umask(2) value, and thus, users with a safe umask (0077)\r
106    can use this option. <emphasis>0640</emphasis> will create a repository which is group-readable\r
107    but not writable. <emphasis>0660</emphasis> is equivalent to <emphasis>group</emphasis>.\r
108 </simpara>\r
109 </listitem>\r
110 </itemizedlist>\r
111 <simpara>By default, the configuration flag receive.denyNonFastForwards is enabled\r
112 in shared repositories, so that you cannot force a non fast-forwarding push\r
113 into it.</simpara>\r
114 </simplesect>\r
115 <simplesect id="_description">\r
116 <title>DESCRIPTION</title>\r
117 <simpara>This command creates an empty git repository - basically a <literal>.git</literal> directory\r
118 with subdirectories for <literal>objects</literal>, <literal>refs/heads</literal>, <literal>refs/tags</literal>, and\r
119 template files.\r
120 An initial <literal>HEAD</literal> file that references the HEAD of the master branch\r
121 is also created.</simpara>\r
122 <simpara>If the <literal>$GIT_DIR</literal> environment variable is set then it specifies a path\r
123 to use instead of <literal>./.git</literal> for the base of the repository.</simpara>\r
124 <simpara>If the object storage directory is specified via the <literal>$GIT_OBJECT_DIRECTORY</literal>\r
125 environment variable then the sha1 directories are created underneath -\r
126 otherwise the default <literal>$GIT_DIR/objects</literal> directory is used.</simpara>\r
127 <simpara>Running <emphasis>git-init</emphasis> in an existing repository is safe. It will not overwrite\r
128 things that are already there. The primary reason for rerunning <emphasis>git-init</emphasis>\r
129 is to pick up newly added templates.</simpara>\r
130 <simpara>Note that <emphasis>git-init</emphasis> is the same as <emphasis>git-init-db</emphasis>.  The command\r
131 was primarily meant to initialize the object database, but over\r
132 time it has become responsible for setting up the other aspects\r
133 of the repository, such as installing the default hooks and\r
134 setting the configuration variables.  The old name is retained\r
135 for backward compatibility reasons.</simpara>\r
136 </simplesect>\r
137 <simplesect id="_examples">\r
138 <title>EXAMPLES</title>\r
139 <variablelist>\r
140 <varlistentry>\r
141 <term>\r
142 Start a new git repository for an existing code base\r
143 </term>\r
144 <listitem>\r
145 <literallayout>$ cd /path/to/my/codebase\r
146 $ git init      <co id="CO1-1"/>\r
147 $ git add .     <co id="CO1-2"/></literallayout>\r
148 <calloutlist>\r
149 <callout arearefs="CO1-1">\r
150 <simpara>\r
151 prepare /path/to/my/codebase/.git directory\r
152 </simpara>\r
153 </callout>\r
154 <callout arearefs="CO1-2">\r
155 <simpara>\r
156 add all existing file to the index\r
157 </simpara>\r
158 </callout>\r
159 </calloutlist>\r
160 </listitem>\r
161 </varlistentry>\r
162 </variablelist>\r
163 </simplesect>\r
164 <simplesect id="_author">\r
165 <title>Author</title>\r
166 <simpara>Written by Linus Torvalds &lt;<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>&gt;</simpara>\r
167 </simplesect>\r
168 <simplesect id="_documentation">\r
169 <title>Documentation</title>\r
170 <simpara>Documentation by David Greaves, Junio C Hamano and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>\r
171 </simplesect>\r
172 <simplesect id="_git">\r
173 <title>GIT</title>\r
174 <simpara>Part of the <xref linkend="git(1)"/> suite</simpara>\r
175 </simplesect>\r
176 </article>\r