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 where it is supposed to be,
49           place a filesytem-agnostic Git symbolic link there, pointing to the
50           specified path, and initialize a Git repository at the path. The
51           result is Git repository can be separated from working tree. If
52           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): Use permissions reported by umask(2). The
67           default, when --shared is not specified.
68
69       ·   group (or true): Make the repository group-writable, (and g+sx,
70           since the git group may be not the primary group of all users).
71           This is used to loosen the permissions of an otherwise safe
72           umask(2) value. Note that the umask still applies to the other
73           permission bits (e.g. if umask is 0022, using group will not remove
74           read privileges from other (non-group) users). See 0xxx for how to
75           exactly specify the repository permissions.
76
77       ·   all (or world or everybody): Same as group, but make the repository
78           readable by all users.
79
80       ·   0xxx: 0xxx is an octal number and each file will have mode 0xxx.
81           0xxx will override users' umask(2) value (and not only loosen
82           permissions as group and all does).  0640 will create a repository
83           which is group-readable, but not group-writable or accessible to
84           others.  0660 will create a repo that is readable and writable to
85           the current user and group, but inaccessible to others.
86
87       By default, the configuration flag receive.denyNonFastForwards is
88       enabled in shared repositories, so that you cannot force a non
89       fast-forwarding push into it.
90
91       If you name a (possibly non-existent) directory at the end of the
92       command line, the command is run inside the directory (possibly after
93       creating it).
94

TEMPLATE DIRECTORY

96       The template directory contains files and directories that will be
97       copied to the $GIT_DIR after it is created.
98
99       The template directory used will (in order):
100
101       ·   The argument given with the --template option.
102
103       ·   The contents of the $GIT_TEMPLATE_DIR environment variable.
104
105       ·   The init.templatedir configuration variable.
106
107       ·   The default template directory: /usr/share/git-core/templates.
108
109       The default template directory includes some directory structure, some
110       suggested "exclude patterns", and copies of sample "hook" files. The
111       suggested patterns and hook files are all modifiable and extensible.
112

EXAMPLES

114       Start a new Git repository for an existing code base
115
116               $ cd /path/to/my/codebase
117               $ git init      (1)
118               $ git add .     (2)
119
120           1. prepare /path/to/my/codebase/.git directory
121           2. add all existing file to the index
122

GIT

124       Part of the git(1) suite
125
126
127
128Git 1.8.3.1                       11/19/2018                       GIT-INIT(1)
Impressum