git/Documentation
Isabella Caselli a13fc94041 var: add GIT_HOSTNAME
Git asks the system for the name of the machine it runs on in a few
places. For example, "git gc" records it in "gc.pid" to tell whether
the gc holding the lock runs on the same machine. Users have no way
to see which name Git uses, and depending on how the system is
configured, it may be a short name ("myhost") or a fully qualified
one ("myhost.example.com").

This matters more once the config can depend on the hostname, which
a later commit adds as an includeIf condition. Without a way to see
the value Git uses, users would have to guess what to write in their
config file.

Add a GIT_HOSTNAME variable to "git var" that prints the hostname
Git sees. If the hostname can't be determined, "git var GIT_HOSTNAME"
exits with a non-zero status, and "git var -l" omits the variable
instead of failing.

An option to "git config" to show the hostname was also discussed,
but "git var" was chosen, since the hostname is not specific to
the configuration code.

The test only checks that a non-empty value is printed. The test has
no independent way to know the expected hostname, as the "hostname"
command may not agree with what Git sees on every platform. The
includeIf tests added later check that the value matches what the
configuration code uses.

Suggested-by: Eric Sunshine <sunshine@sunshineco.com>
Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Isabella Caselli <bellacaselli20@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-10-12 12:12:50 -07:00
..
RelNotes The 4th batch 2026-10-06 10:13:32 -07:00
config Merge branch 'dk/use-nsec-runtime' 2026-10-01 11:26:41 -07:00
howto doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
includes
…
mergetools
…
technical Merge branch 'dk/use-nsec-runtime' 2026-10-01 11:26:41 -07:00
.gitignore
…
BreakingChanges.adoc setup: rename "init.defaultRefFormat" to "init.defaultRefStorageFormat" 2026-09-09 11:04:31 -07:00
CodingGuidelines Merge branch 'jc/doc-timestamps-in-stat' 2026-05-11 10:05:54 +09:00
DecisionMaking.adoc
…
Makefile Documentation/technical: add paint-down-to-common doc 2026-08-11 07:34:31 -07:00
MyFirstContribution.adoc Merge branch 'wy/doc-myfirstcontribution-trim-quotes' 2026-07-19 10:42:18 -07:00
MyFirstObjectWalk.adoc
…
ReviewingGuidelines.adoc
…
SubmittingPatches Merge branch 'ss/submittingpatches-typofix' 2026-08-25 10:53:32 -07:00
ToolsForGit.adoc
…
asciidoc.conf.in doc: convert git-bisect to synopsis style 2026-05-25 20:05:44 +09:00
asciidoctor-extensions.rb.in
…
blame-options.adoc doc: blame-options: convert to new doc format 2026-01-09 06:15:31 -08:00
build-docdep.perl
…
cat-texi.perl
…
cmd-list.sh
…
config.adoc Merge branch 'kh/doc-replay-config' 2026-08-11 10:07:00 -07:00
date-formats.adoc doc: document and test `@` prefix for raw timestamps 2026-06-02 18:13:12 +09:00
diff-algorithm-option.adoc
…
diff-context-options.adoc diff: document -U without <n> as using default context 2026-03-10 06:17:59 -07:00
diff-format.adoc diff-format.adoc: mode and hash are 0* for unmerged paths from index only 2026-05-16 22:21:37 +09:00
diff-generate-patch.adoc
…
diff-options.adoc doc: convert git-format-patch synopsis and options to new style 2026-07-23 14:26:58 -07:00
doc-diff
…
docbook-xsl.css
…
docbook.xsl
…
docinfo-html.in
…
everyday.adoco
…
fetch-options.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
fix-texi.sh
…
for-each-ref-options.adoc doc: fix some style issues in git-clone and for-each-ref-options 2026-02-05 21:14:05 -08:00
format-patch-caveats.adoc doc: convert git-am synopsis and options to new style 2026-05-25 20:05:44 +09:00
format-patch-end-of-commit-message.adoc doc: convert git-am synopsis and options to new style 2026-05-25 20:05:44 +09:00
fsck-msgids.adoc builtin/fsck: move generic HEAD check into `refs_fsck()` 2026-01-12 06:55:41 -08:00
generate-mergetool-list.sh
…
git-add.adoc Merge branch 'kz/doc-add-rm-typofix' 2026-10-06 10:13:31 -07:00
git-am.adoc doc: convert git-am synopsis and options to new style 2026-05-25 20:05:44 +09:00
git-annotate.adoc
…
git-apply.adoc doc: convert git-apply synopsis and options to new style 2026-05-25 20:05:44 +09:00
git-archimport.adoc
…
git-archive.adoc archive: document --prefix handling of absolute and parent paths 2026-04-08 11:13:52 -07:00
git-backfill.adoc pack-objects: support sparse:oid filter with path-walk 2026-05-24 18:41:06 +09:00
git-bisect-lk2009.adoc
…
git-bisect.adoc bisect: add --reset-when-found to leave when done 2026-08-02 16:34:36 -07:00
git-blame.adoc blame: reserve mark column only if necessary 2026-07-06 07:34:48 -07:00
git-branch.adoc branch: add --dry-run for --delete-merged 2026-08-05 10:08:28 -07:00
git-bugreport.adoc
…
git-bundle.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-cat-file.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-check-attr.adoc
…
git-check-ignore.adoc
…
git-check-mailmap.adoc
…
git-check-ref-format.adoc
…
git-checkout-index.adoc
…
git-checkout.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-cherry-pick.adoc doc: cherry-pick: note --no-commit skips CHERRY_PICK_HEAD 2026-09-05 17:46:26 -07:00
git-cherry.adoc
…
git-citool.adoc
…
git-clean.adoc
…
git-clone.adoc setup: allow "--ref-storage-format=" to specify a payload 2026-09-09 11:04:31 -07:00
git-column.adoc
…
git-commit-graph.adoc doc: add caveat about turning off commit-graph 2026-05-08 10:22:33 +09:00
git-commit-tree.adoc
…
git-commit.adoc
…
git-config.adoc doc: git-config: escape erroneous highlight markup 2026-06-11 12:08:17 -07:00
git-count-objects.adoc
…
git-credential-cache--daemon.adoc
…
git-credential-cache.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-credential-store.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-credential.adoc
…
git-cvsexportcommit.adoc
…
git-cvsimport.adoc
…
git-cvsserver.adoc
…
git-daemon.adoc
…
git-describe.adoc doc: convert git-describe manual page to synopsis style 2026-04-06 09:38:19 -07:00
git-diagnose.adoc
…
git-diff-files.adoc
…
git-diff-index.adoc
…
git-diff-pairs.adoc
…
git-diff-tree.adoc
…
git-diff.adoc
…
git-difftool.adoc doc: convert git-difftool manual page to synopsis style 2026-04-06 09:38:18 -07:00
git-fast-export.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-fast-import.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-fetch-pack.adoc
…
git-fetch.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-filter-branch.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-fmt-merge-msg.adoc
…
git-for-each-ref.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-for-each-repo.adoc
…
git-format-patch.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-format-rev.adoc doc: format-rev: use [synopsis] on code block 2026-08-17 13:33:06 -07:00
git-fsck-objects.adoc
…
git-fsck.adoc
…
git-fsmonitor--daemon.adoc fsmonitor: implement filesystem change listener for Linux 2026-04-15 08:44:33 -07:00
git-gc.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-get-tar-commit-id.adoc
…
git-grep.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-gui.adoc
…
git-hash-object.adoc
…
git-help.adoc
…
git-history.adoc history: support editing squashed commit messages 2026-09-08 13:51:10 -07:00
git-hook.adoc doc: hook: don’t self-link via config include 2026-05-22 09:36:20 +09:00
git-http-backend.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-http-fetch.adoc http: avoid concurrent appends to partial packs 2026-07-27 12:57:20 -07:00
git-http-push.adoc
…
git-imap-send.adoc Merge branch 'wf/imap-send-draft' 2026-09-14 14:02:52 -07:00
git-index-pack.adoc
…
git-init-db.adoc
…
git-init.adoc setup: allow "--ref-storage-format=" to specify a payload 2026-09-09 11:04:31 -07:00
git-instaweb.adoc
…
git-interpret-trailers.adoc trailers: stop recognizing URLs as trailers 2026-08-21 08:53:27 -07:00
git-last-modified.adoc last-modified: change default max-depth to 0 2026-01-20 14:13:04 -08:00
git-log.adoc doc: log: use the same delimiter in description list 2026-04-28 09:46:26 +09:00
git-ls-files.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-ls-remote.adoc
…
git-ls-tree.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-mailinfo.adoc
…
git-mailsplit.adoc
…
git-maintenance.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-merge-base.adoc
…
git-merge-file.adoc merge-file: honor merge.conflictStyle outside of a repository 2026-02-07 17:04:26 -08:00
git-merge-index.adoc
…
git-merge-one-file.adoc
…
git-merge-tree.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-merge.adoc
…
git-mergetool--lib.adoc
…
git-mergetool.adoc
…
git-mktag.adoc
…
git-mktree.adoc
…
git-multi-pack-index.adoc midx: support custom `--base` for incremental MIDX writes 2026-05-20 11:31:13 +09:00
git-mv.adoc
…
git-name-rev.adoc name-rev: update hash descriptions 2026-09-28 10:58:22 -07:00
git-notes.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-p4.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-pack-objects.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-pack-redundant.adoc
…
git-pack-refs.adoc doc/pack-refs: convert synopsis and options to new style 2026-09-15 09:22:15 -07:00
git-patch-id.adoc doc: patch-id: see also git-cherry(1) 2026-02-17 10:49:51 -08:00
git-prune-packed.adoc
…
git-prune.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-pull.adoc
…
git-push.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-quiltimport.adoc
…
git-range-diff.adoc Merge branch 'sp/doc-range-diff-takes-notes' 2026-05-31 10:00:39 +09:00
git-read-tree.adoc
…
git-rebase.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-receive-pack.adoc hook: introduce the receive-report hook 2026-09-11 14:28:40 -07:00
git-reflog.adoc
…
git-refs.adoc Merge branch 'ps/ref-storage-format' 2026-10-01 11:26:40 -07:00
git-remote-ext.adoc
…
git-remote-fd.adoc
…
git-remote-helpers.adoco
…
git-remote.adoc
…
git-repack.adoc builtin/repack: add guards for --drop-filtered 2026-08-13 13:34:50 -07:00
git-replace.adoc doc: add caveat about turning off commit-graph 2026-05-08 10:22:33 +09:00
git-replay.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-repo.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-request-pull.adoc doc: convert git-request-pull synopsis and options to new style 2026-07-23 14:26:58 -07:00
git-rerere.adoc doc: fix singular/plural mismatch in git-rerere 2026-04-16 21:22:01 -07:00
git-reset.adoc doc: git-reset: clarify `git reset <pathspec>` 2026-01-06 08:10:14 +09:00
git-restore.adoc Merge branch 'kh/doc-restore-double-underscores-fix' 2026-05-19 09:57:45 +09:00
git-rev-list.adoc
…
git-rev-parse.adoc Merge branch 'je/doc-asciidoc-xrefs' 2026-10-05 13:52:29 -07:00
git-revert.adoc
…
git-rm.adoc doc: remove unnecessary commas in git-add and git-rm documentation 2026-09-29 16:25:01 -07:00
git-send-email.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-send-pack.adoc
…
git-sh-i18n--envsubst.adoc
…
git-sh-i18n.adoc
…
git-sh-setup.adoc
…
git-shell.adoc
…
git-shortlog.adoc doc: convert git-shortlog manual page to synopsis style 2026-04-06 09:38:19 -07:00
git-show-branch.adoc
…
git-show-index.adoc
…
git-show-ref.adoc
…
git-show.adoc doc: convert git-show to synopsis style 2026-02-05 21:14:05 -08:00
git-sparse-checkout.adoc doc: fix typos via codespell 2026-06-08 00:21:35 +09:00
git-stage.adoc
…
git-stash.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-status.adoc
…
git-stripspace.adoc
…
git-submodule.adoc builtin/submodule: rename "--ref-format=" to "--ref-storage-format=" 2026-09-09 11:04:30 -07:00
git-svn.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-switch.adoc checkout -m: autostash when switching branches 2026-04-29 21:46:03 +09:00
git-symbolic-ref.adoc
…
git-tag.adoc
…
git-tools.adoc
…
git-unpack-file.adoc
…
git-unpack-objects.adoc
…
git-update-index.adoc
…
git-update-ref.adoc Merge branch 'sb/doc-update-ref-markup-fix' 2026-01-23 13:34:35 -08:00
git-update-server-info.adoc
…
git-upload-archive.adoc
…
git-upload-pack.adoc
…
git-url-parse.adoc doc: describe the url-parse builtin 2026-05-06 09:48:29 +09:00
git-var.adoc var: add GIT_HOSTNAME 2026-10-12 12:12:50 -07:00
git-verify-commit.adoc
…
git-verify-pack.adoc
…
git-verify-tag.adoc
…
git-version.adoc
…
git-web--browse.adoc
…
git-whatchanged.adoc
…
git-worktree.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
git-write-tree.adoc
…
git.adoc Merge branch 'ps/ref-storage-format' 2026-10-01 11:26:40 -07:00
gitattributes.adoc userdiff: add support for Swift 2026-07-23 07:14:34 -07:00
gitcli.adoc
…
gitcore-tutorial.adoc
…
gitcredentials.adoc
…
gitcvs-migration.adoc doc: gitcvs-migration: rephrase “man page” 2026-04-06 09:57:07 -07:00
gitdatamodel.adoc doc: datamodel: link to the glossary 2026-09-05 17:37:49 -07:00
gitdiffcore.adoc
…
giteveryday.adoc
…
gitfaq.adoc Merge branch 'bc/doc-stash-import-export' 2026-01-16 12:40:27 -08:00
gitformat-bundle.adoc
…
gitformat-chunk.adoc
…
gitformat-commit-graph.adoc
…
gitformat-index.adoc ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR 2026-05-13 10:25:52 +09:00
gitformat-loose.adoc rust: add a new binary object map format 2026-02-07 17:41:03 -08:00
gitformat-pack.adoc midx: do not require packs to be sorted in lexicographic order 2026-02-24 11:16:33 -08:00
gitformat-signature.adoc
…
gitglossary.adoc doc: glossary: link four of the terms to gitdatamodel(7) 2026-09-05 17:37:49 -07:00
githooks.adoc hook: introduce the receive-report hook 2026-09-11 14:28:40 -07:00
gitignore.adoc ignore: note info/exclude lives in GIT_COMMON_DIR, not GIT_DIR 2026-05-13 10:25:52 +09:00
gitk.adoc
…
gitmailmap.adoc
…
gitmodules.adoc doc: fix grammar errors in submodule description 2026-04-16 21:22:01 -07:00
gitnamespaces.adoc
…
gitpacking.adoc Documentation: fix broken `sampleRate` in gitpacking(7) 2026-05-12 10:36:18 +09:00
gitprotocol-capabilities.adoc
…
gitprotocol-common.adoc
…
gitprotocol-http.adoc
…
gitprotocol-pack.adoc doc: gitprotocol-pack: normalize italic formatting 2026-03-02 21:35:05 -08:00
gitprotocol-v2.adoc cat-file: unify default format 2026-08-07 18:50:08 -07:00
gitremote-helpers.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
gitrepository-layout.adoc
…
gitrevisions.adoc
…
gitsubmodules.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
gittutorial-2.adoc
…
gittutorial.adoc doc: replace git config --list/-l with `list` 2026-04-06 09:57:07 -07:00
gitweb.adoc
…
gitweb.conf.adoc
…
gitworkflows.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
glossary-content.adoc doc: glossary: link four of the terms to gitdatamodel(7) 2026-09-05 17:37:49 -07:00
i18n.adoc
…
install-doc-quick.sh
…
install-webdoc.sh
…
line-range-format.adoc
…
line-range-options.adoc line-log: allow non-patch diff formats with -L 2026-05-29 14:06:21 +09:00
lint-delimited-sections.perl
…
lint-documentation-style.perl
…
lint-fsck-msgids.perl
…
lint-gitlink.perl lint-gitlink: don't use empty lower bound in .{0,8} 2026-09-08 15:07:01 -07:00
lint-man-end-blurb.perl
…
lint-man-section-order.perl
…
lint-manpages.sh
…
manpage-bold-literal.xsl
…
manpage-normal.xsl
…
manpage.xsl
…
merge-options.adoc
…
merge-strategies.adoc
…
meson.build meson: expose knob for xmlto relative links in manuals 2026-09-11 11:10:00 -07:00
object-format-disclaimer.adoc
…
pack-refs-options.adoc doc/pack-refs: convert synopsis and options to new style 2026-09-15 09:22:15 -07:00
pretty-formats.adoc docs/pretty-formats: add %(count) and %(total) 2026-03-23 13:06:58 -07:00
pretty-options.adoc
…
pull-fetch-param.adoc
…
ref-reachability-filters.adoc
…
ref-storage-format.adoc docs: correct information about reftable 2026-04-08 07:18:56 -07:00
rerere-options.adoc doc: rerere-options.adoc: link to git-rerere(1) 2026-02-10 12:27:07 -08:00
rev-list-description.adoc
…
rev-list-options.adoc rev-list: add --missing-only option to filter output 2026-09-03 14:39:41 -07:00
revisions.adoc doc: add more AsciiDoc cross-references 2026-09-25 09:11:18 -07:00
scalar.adoc
…
sequencer.adoc
…
signoff-option.adoc
…
texi.xsl
…
trace2-target-values.adoc
…
transfer-data-leaks.adoc
…
urls-remotes.adoc
…
urls.adoc
…
user-manual.adoc doc: replace git config --list/-l with `list` 2026-04-06 09:57:07 -07:00