Home Explore Blog CI



git

3rd chunk of `Documentation/git-init.adoc`
749144a345e5240569130b9dcd60fcae91c410d414851c970000000100000bc9
 are created with the
requested permissions.  When not specified, Git will use permissions reported
by `umask`(2).
+
The option can have the following values, defaulting to `group` if no value
is given:
+
--
`umask`::
`false`::

Use permissions reported by `umask`(2). The default, when `--shared` is not
specified.

`group`::
`true`::

Make the repository group-writable, (and `g+sx`, since the git group may not be
the primary group of all users). This is used to loosen the permissions of an
otherwise safe `umask`(2) value. Note that the umask still applies to the other
permission bits (e.g. if umask is `0022`, using `group` will not remove read
privileges from other (non-group) users). See `0xxx` for how to exactly specify
the repository permissions.

`all`::
`world`::
`everybody`::

Same as `group`, but make the repository readable by all users.

_<perm>_::

_<perm>_ is a 3-digit octal number prefixed with `0` and each file
will have mode _<perm>_. _<perm>_ will override users' `umask`(2)
value (and not only loosen permissions as `group` and `all`
do). `0640` will create a repository which is group-readable, but
not group-writable or accessible to others. `0660` will create a repo
that is readable and writable to the current user and group, but
inaccessible to others (directories and executable files get their
`x` bit from the `r` bit for corresponding classes of users).
--

By default, the configuration flag `receive.denyNonFastForwards` is enabled
in shared repositories, so that you cannot force a non fast-forwarding push
into it.

If you provide a _<directory>_, the command is run inside it. If this directory
does not exist, it will be created.

TEMPLATE DIRECTORY
------------------

Files and directories in the template directory whose name do not start with a
dot will be copied to the `$GIT_DIR` after it is created.

The template directory will be one of the following (in order):

 - the argument given with the `--template` option;

 - the contents of the `$GIT_TEMPLATE_DIR` environment variable;

 - the `init.templateDir` configuration variable; or

 - the default template directory: `/usr/share/git-core/templates`.

The default template directory includes some directory structure, suggested
"exclude patterns" (see linkgit:gitignore[5]), and sample hook files.

The sample hooks are all disabled by default. To enable one of the
sample hooks rename it by removing its `.sample` suffix.

See linkgit:githooks[5] for more general info on hook execution.

EXAMPLES
--------

Start a new Git repository for an existing code base::
+
----------------
$ cd /path/to/my/codebase
$ git init      <1>
$ git add .     <2>
$ git commit    <3>
----------------
+
<1> Create a `/path/to/my/codebase/.git` directory.
<2> Add all existing files to the index.
<3> Record the pristine state as the first commit in the history.

CONFIGURATION
-------------

include::includes/cmd-config-section-all.adoc[]

:git-init:

include::config/init.adoc[]

GIT
---
Part of the linkgit:git[1] suite

Title: Git Init Command Options and Configuration
Summary
The git init command allows for customization of repository setup, including shared repository permissions, template directories, and configuration flags, to facilitate collaboration and version control in a Git repository.