Home Explore Blog CI



git

13th chunk of `Documentation/git.adoc`
93fec7fbe907f634a21fb6e2b83f372c4d009f60776e4eaa0000000100000fa6
 fetch/push/clone which are
	configured to the `user` state.  This is useful to restrict recursive
	submodule initialization from an untrusted repository or for programs
	which feed potentially-untrusted URLS to git commands.  See
	linkgit:git-config[1] for more details.

`GIT_PROTOCOL`::
	For internal use only.  Used in handshaking the wire protocol.
	Contains a colon ':' separated list of keys with optional values
	'<key>[=<value>]'.  Presence of unknown keys and values must be
	ignored.
+
Note that servers may need to be configured to allow this variable to
pass over some transports. It will be propagated automatically when
accessing local repositories (i.e., `file://` or a filesystem path), as
well as over the `git://` protocol. For git-over-http, it should work
automatically in most configurations, but see the discussion in
linkgit:git-http-backend[1]. For git-over-ssh, the ssh server may need
to be configured to allow clients to pass this variable (e.g., by using
`AcceptEnv GIT_PROTOCOL` with OpenSSH).
+
This configuration is optional. If the variable is not propagated, then
clients will fall back to the original "v0" protocol (but may miss out
on some performance improvements or features). This variable currently
only affects clones and fetches; it is not yet used for pushes (but may
be in the future).

`GIT_OPTIONAL_LOCKS`::
	If this Boolean environment variable is set to false, Git will complete any requested operation without
	performing any optional sub-operations that require taking a lock.
	For example, this will prevent `git status` from refreshing the
	index as a side effect. This is useful for processes running in
	the background which do not want to cause lock contention with
	other operations on the repository.  Defaults to `1`.

`GIT_REDIRECT_STDIN`::
`GIT_REDIRECT_STDOUT`::
`GIT_REDIRECT_STDERR`::
	Windows-only: allow redirecting the standard input/output/error
	handles to paths specified by the environment variables. This is
	particularly useful in multi-threaded applications where the
	canonical way to pass standard handles via `CreateProcess()` is
	not an option because it would require the handles to be marked
	inheritable (and consequently *every* spawned process would
	inherit them, possibly blocking regular Git operations). The
	primary intended use case is to use named pipes for communication
	(e.g. `\\.\pipe\my-git-stdin-123`).
+
Two special values are supported: `off` will simply close the
corresponding standard handle, and if `GIT_REDIRECT_STDERR` is
`2>&1`, standard error will be redirected to the same handle as
standard output.

`GIT_PRINT_SHA1_ELLIPSIS` (deprecated)::
	If set to `yes`, print an ellipsis following an
	(abbreviated) SHA-1 value.  This affects indications of
	detached HEADs (linkgit:git-checkout[1]) and the raw
	diff output (linkgit:git-diff[1]).  Printing an
	ellipsis in the cases mentioned is no longer considered
	adequate and support for it is likely to be removed in the
	foreseeable future (along with the variable).

`GIT_ADVICE`::
	If set to `0`, then disable all advice messages. These messages are
	intended to provide hints to human users that may help them get out of
	problematic situations or take advantage of new features. Users can
	disable individual messages using the `advice.*` config keys. These
	messages may be disruptive to tools that execute Git processes, so this
	variable is available to disable the messages. (The `--no-advice`
	global option is also available, but old Git versions may fail when
	this option is not understood. The environment variable will be ignored
	by Git versions that do not understand it.)

Discussion[[Discussion]]
------------------------

More detail on the following is available from the
link:user-manual.html#git-concepts[Git concepts chapter of the
user-manual] and linkgit:gitcore-tutorial[7].

A Git project normally consists of a working directory with a ".git"
subdirectory at the top level.  The .git directory contains, among other
things,

Title: Git Environment Variables for Protocol, Locks, and Output
Summary
This section of the Git documentation covers environment variables for customizing protocol behavior, optional locks, and standard input/output/error handles, including variables for restricting recursive submodule initialization, controlling protocol versions, and redirecting standard handles on Windows, as well as variables for disabling advice messages and printing SHA-1 ellipses.