1GIT-INIT(1)                       Git Manual                       GIT-INIT(1)
2
3
4

NAME

6       git-init - Create an empty Git repository or reinitialize an existing
7       one
8

SYNOPSIS

10       git init [-q | --quiet] [--bare] [--template=<template_directory>]
11                 [--separate-git-dir <git dir>]
12                 [--shared[=<permissions>]] [directory]
13
14

DESCRIPTION

16       This command creates an empty Git repository - basically a .git
17       directory with subdirectories for objects, refs/heads, refs/tags, and
18       template files. An initial HEAD file that references the HEAD of the
19       master branch is also created.
20
21       If the $GIT_DIR environment variable is set then it specifies a path to
22       use instead of ./.git for the base of the repository.
23
24       If the object storage directory is specified via the
25       $GIT_OBJECT_DIRECTORY environment variable then the sha1 directories
26       are created underneath - otherwise the default $GIT_DIR/objects
27       directory is used.
28
29       Running git init in an existing repository is safe. It will not
30       overwrite things that are already there. The primary reason for
31       rerunning git init is to pick up newly added templates (or to move the
32       repository to another place if --separate-git-dir is given).
33

OPTIONS

35       -q, --quiet
36           Only print error and warning messages; all other output will be
37           suppressed.
38
39       --bare
40           Create a bare repository. If GIT_DIR environment is not set, it is
41           set to the current working directory.
42
43       --template=<template_directory>
44           Specify the directory from which templates will be used. (See the
45           "TEMPLATE DIRECTORY" section below.)
46
47       --separate-git-dir=<git dir>
48           Instead of initializing the repository as a directory to either
49           $GIT_DIR or ./.git/, create a text file there containing the path
50           to the actual repository. This file acts as filesystem-agnostic Git
51           symbolic link to the repository.
52
53           If this is reinitialization, the repository will be moved to the
54           specified path.
55
56       --shared[=(false|true|umask|group|all|world|everybody|0xxx)]
57           Specify that the Git repository is to be shared amongst several
58           users. This allows users belonging to the same group to push into
59           that repository. When specified, the config variable
60           "core.sharedRepository" is set so that files and directories under
61           $GIT_DIR are created with the requested permissions. When not
62           specified, Git will use permissions reported by umask(2).
63
64           The option can have the following values, defaulting to group if no
65           value is given:
66
67           umask (or false)
68               Use permissions reported by umask(2). The default, when
69               --shared is not specified.
70
71           group (or true)
72               Make the repository group-writable, (and g+sx, since the git
73               group may be not the primary group of all users). This is used
74               to loosen the permissions of an otherwise safe umask(2) value.
75               Note that the umask still applies to the other permission bits
76               (e.g. if umask is 0022, using group will not remove read
77               privileges from other (non-group) users). See 0xxx for how to
78               exactly specify the repository permissions.
79
80           all (or world or everybody)
81               Same as group, but make the repository readable by all users.
82
83           0xxx
84               0xxx is an octal number and each file will have mode 0xxx.
85               0xxx will override users' umask(2) value (and not only loosen
86               permissions as group and all does).  0640 will create a
87               repository which is group-readable, but not group-writable or
88               accessible to others.  0660 will create a repo that is readable
89               and writable to the current user and group, but inaccessible to
90               others.
91
92       By default, the configuration flag receive.denyNonFastForwards is
93       enabled in shared repositories, so that you cannot force a non
94       fast-forwarding push into it.
95
96       If you provide a directory, the command is run inside it. If this
97       directory does not exist, it will be created.
98

TEMPLATE DIRECTORY

100       Files and directories in the template directory whose name do not start
101       with a dot will be copied to the $GIT_DIR after it is created.
102
103       The template directory will be one of the following (in order):
104
105       ·   the argument given with the --template option;
106
107       ·   the contents of the $GIT_TEMPLATE_DIR environment variable;
108
109       ·   the init.templateDir configuration variable; or
110
111       ·   the default template directory: /usr/share/git-core/templates.
112
113       The default template directory includes some directory structure,
114       suggested "exclude patterns" (see gitignore(5)), and sample hook files.
115
116       The sample hooks are all disabled by default, To enable one of the
117       sample hooks rename it by removing its .sample suffix.
118
119       See githooks(5) for more general info on hook execution.
120

EXAMPLES

122       Start a new Git repository for an existing code base
123
124               $ cd /path/to/my/codebase
125               $ git init      (1)
126               $ git add .     (2)
127               $ git commit    (3)
128
129           1. Create a /path/to/my/codebase/.git directory.
130           2. Add all existing files to the index.
131           3. Record the pristine state as the first commit in the history.
132

GIT

134       Part of the git(1) suite
135
136
137
138Git 2.20.1                        12/15/2018                       GIT-INIT(1)
Impressum