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