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