forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgit-init.1
More file actions
242 lines (238 loc) · 6.52 KB
/
git-init.1
File metadata and controls
242 lines (238 loc) · 6.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
'\" t
.\" Title: git-init
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\" Date: 11/06/2010
.\" Manual: Git Manual
.\" Source: Git 1.7.3.2.161.g3089c
.\" Language: English
.\"
.TH "GIT\-INIT" "1" "11/06/2010" "Git 1\&.7\&.3\&.2\&.161\&.g308" "Git Manual"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-init \- Create an empty git repository or reinitialize an existing one
.SH "SYNOPSIS"
.sp
\fIgit init\fR [\-q | \-\-quiet] [\-\-bare] [\-\-template=<template_directory>] [\-\-shared[=<permissions>]] [directory]
.SH "OPTIONS"
.PP
\-q, \-\-quiet
.RS 4
Only print error and warning messages, all other output will be suppressed\&.
.RE
.PP
\-\-bare
.RS 4
Create a bare repository\&. If GIT_DIR environment is not set, it is set to the current working directory\&.
.RE
.PP
\-\-template=<template_directory>
.RS 4
Specify the directory from which templates will be used\&. (See the "TEMPLATE DIRECTORY" section below\&.)
.RE
.PP
\-\-shared[=(false|true|umask|group|all|world|everybody|0xxx)]
.RS 4
Specify that the git repository is to be shared amongst several users\&. This allows users belonging to the same group to push into that repository\&. When specified, the config variable "core\&.sharedRepository" is set so that files and directories under
$GIT_DIR
are created with the requested permissions\&. When not specified, git will use permissions reported by umask(2)\&.
.RE
.sp
The option can have the following values, defaulting to \fIgroup\fR if no value is given:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fIumask\fR
(or
\fIfalse\fR): Use permissions reported by umask(2)\&. The default, when
\-\-shared
is not specified\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fIgroup\fR
(or
\fItrue\fR): Make the repository group\-writable, (and g+sx, since the git group may be not the primary group of all users)\&. This is used to loosen the permissions of an otherwise safe umask(2) value\&. Note that the umask still applies to the other permission bits (e\&.g\&. if umask is
\fI0022\fR, using
\fIgroup\fR
will not remove read privileges from other (non\-group) users)\&. See
\fI0xxx\fR
for how to exactly specify the repository permissions\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fIall\fR
(or
\fIworld\fR
or
\fIeverybody\fR): Same as
\fIgroup\fR, but make the repository readable by all users\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fI0xxx\fR:
\fI0xxx\fR
is an octal number and each file will have mode
\fI0xxx\fR\&.
\fI0xxx\fR
will override users\(aq umask(2) value (and not only loosen permissions as
\fIgroup\fR
and
\fIall\fR
does)\&.
\fI0640\fR
will create a repository which is group\-readable, but not group\-writable or accessible to others\&.
\fI0660\fR
will create a repo that is readable and writable to the current user and group, but inaccessible to others\&.
.RE
.sp
By default, the configuration flag receive\&.denyNonFastForwards is enabled in shared repositories, so that you cannot force a non fast\-forwarding push into it\&.
.sp
If you name a (possibly non\-existent) directory at the end of the command line, the command is run inside the directory (possibly after creating it)\&.
.SH "DESCRIPTION"
.sp
This command creates an empty git repository \- basically a \&.git directory with subdirectories for objects, refs/heads, refs/tags, and template files\&. An initial HEAD file that references the HEAD of the master branch is also created\&.
.sp
If the $GIT_DIR environment variable is set then it specifies a path to use instead of \&./\&.git for the base of the repository\&.
.sp
If the object storage directory is specified via the $GIT_OBJECT_DIRECTORY environment variable then the sha1 directories are created underneath \- otherwise the default $GIT_DIR/objects directory is used\&.
.sp
Running \fIgit init\fR in an existing repository is safe\&. It will not overwrite things that are already there\&. The primary reason for rerunning \fIgit init\fR is to pick up newly added templates\&.
.sp
Note that \fIgit init\fR is the same as \fIgit init\-db\fR\&. The command was primarily meant to initialize the object database, but over time it has become responsible for setting up the other aspects of the repository, such as installing the default hooks and setting the configuration variables\&. The old name is retained for backward compatibility reasons\&.
.SH "TEMPLATE DIRECTORY"
.sp
The template directory contains files and directories that will be copied to the $GIT_DIR after it is created\&.
.sp
The template directory used will (in order):
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The argument given with the
\-\-template
option\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The contents of the
$GIT_TEMPLATE_DIR
environment variable\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The
init\&.templatedir
configuration variable\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The default template directory:
/usr/share/git\-core/templates\&.
.RE
.sp
The default template directory includes some directory structure, some suggested "exclude patterns", and copies of sample "hook" files\&. The suggested patterns and hook files are all modifiable and extensible\&.
.SH "EXAMPLES"
.PP
Start a new git repository for an existing code base
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
$ cd /path/to/my/codebase
$ git init \fB(1)\fR
$ git add \&. \fB(2)\fR
.fi
.if n \{\
.RE
.\}
.sp
\fB1. \fRprepare /path/to/my/codebase/\&.git directory
.br
\fB2. \fRadd all existing file to the index
.br
.RE
.SH "AUTHOR"
.sp
Written by Linus Torvalds <\m[blue]\fBtorvalds@osdl\&.org\fR\m[]\&\s-2\u[1]\d\s+2>
.SH "DOCUMENTATION"
.sp
Documentation by David Greaves, Junio C Hamano and the git\-list <\m[blue]\fBgit@vger\&.kernel\&.org\fR\m[]\&\s-2\u[2]\d\s+2>\&.
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite
.SH "NOTES"
.IP " 1." 4
torvalds@osdl.org
.RS 4
\%mailto:torvalds@osdl.org
.RE
.IP " 2." 4
git@vger.kernel.org
.RS 4
\%mailto:git@vger.kernel.org
.RE