]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-init.txt
Make core.sharedRepository more generic
[thirdparty/git.git] / Documentation / git-init.txt
CommitLineData
d145144c
JH
1git-init(1)
2===========
3
4NAME
5----
c3f0baac 6git-init - Create an empty git repository or reinitialize an existing one
d145144c
JH
7
8
9SYNOPSIS
10--------
4576518d 11'git-init' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]
d145144c
JH
12
13
14OPTIONS
15-------
16
17--
18
4576518d
JO
19-q, \--quiet::
20
21Only print error and warning messages, all other output will be suppressed.
22
d145144c
JH
23--template=<template_directory>::
24
25Provide the directory from which templates will be used. The default template
26directory is `/usr/share/git-core/templates`.
27
28When specified, `<template_directory>` is used as the source of the template
29files rather than the default. The template files include some directory
30structure, some suggested "exclude patterns", and copies of non-executing
31"hook" files. The suggested patterns and hook files are all modifiable and
32extensible.
33
06cbe855 34--shared[={false|true|umask|group|all|world|everybody|0xxx}]::
d145144c
JH
35
36Specify that the git repository is to be shared amongst several users. This
37allows users belonging to the same group to push into that
38repository. When specified, the config variable "core.sharedRepository" is
39set so that files and directories under `$GIT_DIR` are created with the
40requested permissions. When not specified, git will use permissions reported
41by umask(2).
42
43The option can have the following values, defaulting to 'group' if no value
44is given:
45
46 - 'umask' (or 'false'): Use permissions reported by umask(2). The default,
47 when `--shared` is not specified.
48
49 - 'group' (or 'true'): Make the repository group-writable, (and g+sx, since
50 the git group may be not the primary group of all users).
51
52 - 'all' (or 'world' or 'everybody'): Same as 'group', but make the repository
53 readable by all users.
54
06cbe855
HO
55 - '0xxx': '0xxx' is an octal number and each file will have mode '0xxx'
56 Any option except 'umask' can be set using this option. '0xxx' will
57 override users umask(2) value, and thus, users with a safe umask (0077)
58 can use this option. '0640' will create a repository which is group-readable
59 but not writable. '0660' is equivalent to 'group'.
60
02ff6250 61By default, the configuration flag receive.denyNonFastForwards is enabled
d145144c
JH
62in shared repositories, so that you cannot force a non fast-forwarding push
63into it.
64
65--
66
67
68DESCRIPTION
69-----------
70This command creates an empty git repository - basically a `.git` directory
71with subdirectories for `objects`, `refs/heads`, `refs/tags`, and
72template files.
73An initial `HEAD` file that references the HEAD of the master branch
74is also created.
75
76If the `$GIT_DIR` environment variable is set then it specifies a path
77to use instead of `./.git` for the base of the repository.
78
79If the object storage directory is specified via the `$GIT_OBJECT_DIRECTORY`
80environment variable then the sha1 directories are created underneath -
81otherwise the default `$GIT_DIR/objects` directory is used.
82
83Running `git-init` in an existing repository is safe. It will not overwrite
84things that are already there. The primary reason for rerunning `git-init`
85is to pick up newly added templates.
86
87Note that `git-init` is the same as `git-init-db`. The command
88was primarily meant to initialize the object database, but over
89time it has become responsible for setting up the other aspects
90of the repository, such as installing the default hooks and
91setting the configuration variables. The old name is retained
5c94f87e 92for backward compatibility reasons.
d145144c
JH
93
94
95EXAMPLES
96--------
97
98Start a new git repository for an existing code base::
99+
100----------------
101$ cd /path/to/my/codebase
102$ git-init <1>
103$ git-add . <2>
104----------------
105+
106<1> prepare /path/to/my/codebase/.git directory
107<2> add all existing file to the index
108
109
110Author
111------
112Written by Linus Torvalds <torvalds@osdl.org>
113
114Documentation
115--------------
116Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
117
118GIT
119---
5162e697 120Part of the linkgit:git[7] suite