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

DESCRIPTION

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

OPTIONS

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

TEMPLATE DIRECTORY

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

EXAMPLES

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

GIT

134       Part of the git(1) suite
135
136
137
138Git 2.26.2                        2020-04-20                       GIT-INIT(1)
Impressum