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