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