]>
Commit | Line | Data |
---|---|---|
d145144c JH |
1 | git-init(1) |
2 | =========== | |
3 | ||
4 | NAME | |
5 | ---- | |
c3f0baac | 6 | git-init - Create an empty git repository or reinitialize an existing one |
d145144c JH |
7 | |
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
b1889c36 | 11 | 'git init' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]] |
d145144c JH |
12 | |
13 | ||
14 | OPTIONS | |
15 | ------- | |
16 | ||
17 | -- | |
18 | ||
3240240f SB |
19 | -q:: |
20 | --quiet:: | |
4576518d JO |
21 | |
22 | Only print error and warning messages, all other output will be suppressed. | |
23 | ||
74d3b23f LR |
24 | --bare:: |
25 | ||
26 | Create a bare repository. If GIT_DIR environment is not set, it is set to the | |
27 | current working directory. | |
28 | ||
d145144c JH |
29 | --template=<template_directory>:: |
30 | ||
31 | Provide the directory from which templates will be used. The default template | |
32 | directory is `/usr/share/git-core/templates`. | |
33 | ||
34 | When specified, `<template_directory>` is used as the source of the template | |
35 | files rather than the default. The template files include some directory | |
36 | structure, some suggested "exclude patterns", and copies of non-executing | |
37 | "hook" files. The suggested patterns and hook files are all modifiable and | |
38 | extensible. | |
39 | ||
06cbe855 | 40 | --shared[={false|true|umask|group|all|world|everybody|0xxx}]:: |
d145144c JH |
41 | |
42 | Specify that the git repository is to be shared amongst several users. This | |
43 | allows users belonging to the same group to push into that | |
44 | repository. When specified, the config variable "core.sharedRepository" is | |
45 | set so that files and directories under `$GIT_DIR` are created with the | |
46 | requested permissions. When not specified, git will use permissions reported | |
47 | by umask(2). | |
48 | ||
49 | The option can have the following values, defaulting to 'group' if no value | |
50 | is given: | |
51 | ||
52 | - 'umask' (or 'false'): Use permissions reported by umask(2). The default, | |
53 | when `--shared` is not specified. | |
54 | ||
55 | - 'group' (or 'true'): Make the repository group-writable, (and g+sx, since | |
56 | the git group may be not the primary group of all users). | |
57 | ||
58 | - 'all' (or 'world' or 'everybody'): Same as 'group', but make the repository | |
59 | readable by all users. | |
60 | ||
06cbe855 HO |
61 | - '0xxx': '0xxx' is an octal number and each file will have mode '0xxx' |
62 | Any option except 'umask' can be set using this option. '0xxx' will | |
63 | override users umask(2) value, and thus, users with a safe umask (0077) | |
64 | can use this option. '0640' will create a repository which is group-readable | |
65 | but not writable. '0660' is equivalent to 'group'. | |
66 | ||
02ff6250 | 67 | By default, the configuration flag receive.denyNonFastForwards is enabled |
d145144c JH |
68 | in shared repositories, so that you cannot force a non fast-forwarding push |
69 | into it. | |
70 | ||
71 | -- | |
72 | ||
73 | ||
74 | DESCRIPTION | |
75 | ----------- | |
76 | This command creates an empty git repository - basically a `.git` directory | |
77 | with subdirectories for `objects`, `refs/heads`, `refs/tags`, and | |
78 | template files. | |
79 | An initial `HEAD` file that references the HEAD of the master branch | |
80 | is also created. | |
81 | ||
82 | If the `$GIT_DIR` environment variable is set then it specifies a path | |
83 | to use instead of `./.git` for the base of the repository. | |
84 | ||
85 | If the object storage directory is specified via the `$GIT_OBJECT_DIRECTORY` | |
86 | environment variable then the sha1 directories are created underneath - | |
87 | otherwise the default `$GIT_DIR/objects` directory is used. | |
88 | ||
ba020ef5 JN |
89 | Running 'git-init' in an existing repository is safe. It will not overwrite |
90 | things that are already there. The primary reason for rerunning 'git-init' | |
d145144c JH |
91 | is to pick up newly added templates. |
92 | ||
ba020ef5 | 93 | Note that 'git-init' is the same as 'git-init-db'. The command |
d145144c JH |
94 | was primarily meant to initialize the object database, but over |
95 | time it has become responsible for setting up the other aspects | |
96 | of the repository, such as installing the default hooks and | |
97 | setting the configuration variables. The old name is retained | |
5c94f87e | 98 | for backward compatibility reasons. |
d145144c JH |
99 | |
100 | ||
101 | EXAMPLES | |
102 | -------- | |
103 | ||
104 | Start a new git repository for an existing code base:: | |
105 | + | |
106 | ---------------- | |
107 | $ cd /path/to/my/codebase | |
b1889c36 JN |
108 | $ git init <1> |
109 | $ git add . <2> | |
d145144c JH |
110 | ---------------- |
111 | + | |
112 | <1> prepare /path/to/my/codebase/.git directory | |
113 | <2> add all existing file to the index | |
114 | ||
115 | ||
116 | Author | |
117 | ------ | |
118 | Written by Linus Torvalds <torvalds@osdl.org> | |
119 | ||
120 | Documentation | |
121 | -------------- | |
122 | Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. | |
123 | ||
124 | GIT | |
125 | --- | |
9e1f0a85 | 126 | Part of the linkgit:git[1] suite |