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>] [--object-format=<format>]
12                 [-b <branch-name> | --initial-branch=<branch-name>]
13                 [--shared[=<permissions>]] [<directory>]
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 branch without any commits will be created
19       (see the --initial-branch option below for its name).
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       --object-format=<format>
44           Specify the given object format (hash algorithm) for the
45           repository. The valid values are sha1 and (if enabled) sha256.
46           sha1 is the default.
47
48           Note: At present, there is no interoperability between SHA-256
49           repositories and SHA-1 repositories.
50
51       Historically, we warned that SHA-256 repositories may later need
52       backward incompatible changes when we introduce such interoperability
53       features. Today, we only expect compatible changes. Furthermore, if
54       such changes prove to be necessary, it can be expected that SHA-256
55       repositories created with today’s Git will be usable by future versions
56       of Git without data loss.
57
58       --template=<template-directory>
59           Specify the directory from which templates will be used. (See the
60           "TEMPLATE DIRECTORY" section below.)
61
62       --separate-git-dir=<git-dir>
63           Instead of initializing the repository as a directory to either
64           $GIT_DIR or ./.git/, create a text file there containing the path
65           to the actual repository. This file acts as a filesystem-agnostic
66           Git symbolic link to the repository.
67
68           If this is a reinitialization, the repository will be moved to the
69           specified path.
70
71       -b <branch-name>, --initial-branch=<branch-name>
72           Use the specified name for the initial branch in the newly created
73           repository. If not specified, fall back to the default name