config: allow specifying config entries via envvar pairs

While we currently have the `GIT_CONFIG_PARAMETERS` environment variable
which can be used to pass runtime configuration data to git processes,
it's an internal implementation detail and not supposed to be used by
end users.

Next to being for internal use only, this way of passing config entries
has a major downside: the config keys need to be parsed as they contain
both key and value in a single variable. As such, it is left to the user
to escape any potentially harmful characters in the value, which is
quite hard to do if values are controlled by a third party.

This commit thus adds a new way of adding config entries via the
environment which gets rid of this shortcoming. If the user passes the
`GIT_CONFIG_COUNT=$n` environment variable, Git will parse environment
variable pairs `GIT_CONFIG_KEY_$i` and `GIT_CONFIG_VALUE_$i` for each
`i` in `[0,n)`.

While the same can be achieved with `git -c <name>=<value>`, one may
wish to not do so for potentially sensitive information. E.g. if one
wants to set `http.extraHeader` to contain an authentication token,
doing so via `-c` would trivially leak those credentials via e.g. ps(1),
which typically also shows command arguments.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 files changed
tree: 9ad261640d42b1c2e5cf36830f6c797e711ee547
  1. .github/
  2. block-sha1/
  3. builtin/
  4. ci/
  5. compat/
  6. contrib/
  7. Documentation/
  8. ewah/
  9. git-gui/
  10. gitk-git/
  11. gitweb/
  12. mergetools/
  13. negotiator/
  14. perl/
  15. po/
  16. ppc/
  17. refs/
  18. sha1dc/
  19. sha256/
  20. t/
  21. templates/
  22. trace2/
  23. vcs-svn/
  24. xdiff/
  25. .cirrus.yml
  26. .clang-format
  27. .editorconfig
  28. .gitattributes
  29. .gitignore
  30. .gitmodules
  31. .mailmap
  32. .travis.yml
  33. .tsan-suppressions
  34. abspath.c
  35. aclocal.m4
  36. add-interactive.c
  37. add-interactive.h
  38. add-patch.c
  39. advice.c
  40. advice.h
  41. alias.c
  42. alias.h
  43. alloc.c
  44. alloc.h
  45. apply.c
  46. apply.h
  47. archive-tar.c
  48. archive-zip.c
  49. archive.c
  50. archive.h
  51. attr.c
  52. attr.h
  53. banned.h
  54. base85.c
  55. bisect.c
  56. bisect.h
  57. blame.c
  58. blame.h
  59. blob.c
  60. blob.h
  61. bloom.c
  62. bloom.h
  63. branch.c
  64. branch.h
  65. builtin.h
  66. bulk-checkin.c
  67. bulk-checkin.h
  68. bundle.c
  69. bundle.h
  70. cache-tree.c
  71. cache-tree.h
  72. cache.h
  73. chdir-notify.c
  74. chdir-notify.h
  75. check-builtins.sh
  76. check_bindir
  77. checkout.c
  78. checkout.h
  79. CODE_OF_CONDUCT.md
  80. color.c
  81. color.h
  82. column.c
  83. column.h
  84. combine-diff.c
  85. command-list.txt
  86. commit-graph.c
  87. commit-graph.h
  88. commit-reach.c
  89. commit-reach.h
  90. commit-slab-decl.h
  91. commit-slab-impl.h
  92. commit-slab.h
  93. commit.c
  94. commit.h
  95. common-main.c
  96. config.c
  97. config.h
  98. config.mak.dev
  99. config.mak.in
  100. config.mak.uname
  101. configure.ac
  102. connect.c
  103. connect.h
  104. connected.c
  105. connected.h
  106. convert.c
  107. convert.h
  108. copy.c
  109. COPYING
  110. credential.c
  111. credential.h
  112. csum-file.c
  113. csum-file.h
  114. ctype.c
  115. daemon.c
  116. date.c
  117. decorate.c
  118. decorate.h
  119. delta-islands.c
  120. delta-islands.h
  121. delta.h
  122. detect-compiler
  123. diff-delta.c
  124. diff-lib.c
  125. diff-no-index.c
  126. diff.c
  127. diff.h
  128. diffcore-break.c
  129. diffcore-delta.c
  130. diffcore-order.c
  131. diffcore-pickaxe.c
  132. diffcore-rename.c
  133. diffcore.h
  134. dir-iterator.c
  135. dir-iterator.h
  136. dir.c
  137. dir.h
  138. editor.c
  139. entry.c
  140. environment.c
  141. environment.h
  142. exec-cmd.c
  143. exec-cmd.h
  144. fetch-negotiator.c
  145. fetch-negotiator.h
  146. fetch-pack.c
  147. fetch-pack.h
  148. fmt-merge-msg.c
  149. fmt-merge-msg.h
  150. fsck.c
  151. fsck.h
  152. fsmonitor.c
  153. fsmonitor.h
  154. fuzz-commit-graph.c
  155. fuzz-pack-headers.c
  156. fuzz-pack-idx.c
  157. generate-cmdlist.sh
  158. generate-configlist.sh
  159. gettext.c
  160. gettext.h
  161. git-add--interactive.perl
  162. git-archimport.perl
  163. git-bisect.sh
  164. git-compat-util.h
  165. git-cvsexportcommit.perl
  166. git-cvsimport.perl
  167. git-cvsserver.perl
  168. git-difftool--helper.sh
  169. git-filter-branch.sh
  170. git-instaweb.sh
  171. git-merge-octopus.sh
  172. git-merge-one-file.sh
  173. git-merge-resolve.sh
  174. git-mergetool--lib.sh
  175. git-mergetool.sh
  176. git-p4.py
  177. git-parse-remote.sh
  178. git-quiltimport.sh
  179. git-rebase--preserve-merges.sh
  180. git-request-pull.sh
  181. git-send-email.perl
  182. git-sh-i18n.sh
  183. git-sh-setup.sh
  184. git-submodule.sh
  185. git-svn.perl
  186. GIT-VERSION-GEN
  187. git-web--browse.sh
  188. git.c
  189. git.rc
  190. gpg-interface.c
  191. gpg-interface.h
  192. graph.c
  193. graph.h
  194. grep.c
  195. grep.h
  196. hash.h
  197. hashmap.c
  198. hashmap.h
  199. help.c
  200. help.h
  201. hex.c
  202. http-backend.c
  203. http-fetch.c
  204. http-push.c
  205. http-walker.c
  206. http.c
  207. http.h
  208. ident.c
  209. imap-send.c
  210. INSTALL
  211. iterator.h
  212. json-writer.c
  213. json-writer.h
  214. khash.h
  215. kwset.c
  216. kwset.h
  217. levenshtein.c
  218. levenshtein.h
  219. LGPL-2.1
  220. line-log.c
  221. line-log.h
  222. line-range.c
  223. line-range.h
  224. linear-assignment.c
  225. linear-assignment.h
  226. list-objects-filter-options.c
  227. list-objects-filter-options.h
  228. list-objects-filter.c
  229. list-objects-filter.h
  230. list-objects.c
  231. list-objects.h
  232. list.h
  233. ll-merge.c
  234. ll-merge.h
  235. lockfile.c
  236. lockfile.h
  237. log-tree.c
  238. log-tree.h
  239. ls-refs.c
  240. ls-refs.h
  241. mailinfo.c
  242. mailinfo.h
  243. mailmap.c
  244. mailmap.h
  245. Makefile
  246. match-trees.c
  247. mem-pool.c
  248. mem-pool.h
  249. merge-blobs.c
  250. merge-blobs.h
  251. merge-ort-wrappers.c
  252. merge-ort-wrappers.h
  253. merge-ort.c
  254. merge-ort.h
  255. merge-recursive.c
  256. merge-recursive.h
  257. merge.c
  258. mergesort.c
  259. mergesort.h
  260. midx.c
  261. midx.h
  262. name-hash.c
  263. notes-cache.c
  264. notes-cache.h
  265. notes-merge.c
  266. notes-merge.h
  267. notes-utils.c
  268. notes-utils.h
  269. notes.c
  270. notes.h
  271. object-store.h
  272. object.c
  273. object.h
  274. oid-array.c
  275. oid-array.h
  276. oidmap.c
  277. oidmap.h
  278. oidset.c
  279. oidset.h
  280. pack-bitmap-write.c
  281. pack-bitmap.c
  282. pack-bitmap.h
  283. pack-check.c
  284. pack-objects.c
  285. pack-objects.h
  286. pack-revindex.c
  287. pack-revindex.h
  288. pack-write.c
  289. pack.h
  290. packfile.c
  291. packfile.h
  292. pager.c
  293. parse-options-cb.c
  294. parse-options.c
  295. parse-options.h
  296. patch-delta.c
  297. patch-ids.c
  298. patch-ids.h
  299. path.c
  300. path.h
  301. pathspec.c
  302. pathspec.h
  303. pkt-line.c
  304. pkt-line.h
  305. preload-index.c
  306. pretty.c
  307. pretty.h
  308. prio-queue.c
  309. prio-queue.h
  310. progress.c
  311. progress.h
  312. promisor-remote.c
  313. promisor-remote.h
  314. prompt.c
  315. prompt.h
  316. protocol.c
  317. protocol.h
  318. prune-packed.c
  319. prune-packed.h
  320. quote.c
  321. quote.h
  322. range-diff.c
  323. range-diff.h
  324. reachable.c
  325. reachable.h
  326. read-cache.c
  327. README.md
  328. rebase-interactive.c
  329. rebase-interactive.h
  330. rebase.c
  331. rebase.h
  332. ref-filter.c
  333. ref-filter.h
  334. reflog-walk.c
  335. reflog-walk.h
  336. refs.c
  337. refs.h
  338. refspec.c
  339. refspec.h
  340. remote-curl.c
  341. remote.c
  342. remote.h
  343. replace-object.c
  344. replace-object.h
  345. repo-settings.c
  346. repository.c
  347. repository.h
  348. rerere.c
  349. rerere.h
  350. reset.c
  351. reset.h
  352. resolve-undo.c
  353. resolve-undo.h
  354. revision.c
  355. revision.h
  356. run-command.c
  357. run-command.h
  358. send-pack.c
  359. send-pack.h
  360. sequencer.c
  361. sequencer.h
  362. serve.c
  363. serve.h
  364. server-info.c
  365. setup.c
  366. sh-i18n--envsubst.c
  367. sha1-file.c
  368. sha1-lookup.c
  369. sha1-lookup.h
  370. sha1-name.c
  371. sha1dc_git.c
  372. sha1dc_git.h
  373. shallow.c
  374. shallow.h
  375. shell.c
  376. shortlog.h
  377. sideband.c
  378. sideband.h
  379. sigchain.c
  380. sigchain.h
  381. split-index.c
  382. split-index.h
  383. stable-qsort.c
  384. strbuf.c
  385. strbuf.h
  386. streaming.c
  387. streaming.h
  388. string-list.c
  389. string-list.h
  390. strmap.c
  391. strmap.h
  392. strvec.c
  393. strvec.h
  394. sub-process.c
  395. sub-process.h
  396. submodule-config.c
  397. submodule-config.h
  398. submodule.c
  399. submodule.h
  400. symlinks.c
  401. tag.c
  402. tag.h
  403. tar.h
  404. tempfile.c
  405. tempfile.h
  406. thread-utils.c
  407. thread-utils.h
  408. tmp-objdir.c
  409. tmp-objdir.h
  410. trace.c
  411. trace.h
  412. trace2.c
  413. trace2.h
  414. trailer.c
  415. trailer.h
  416. transport-helper.c
  417. transport-internal.h
  418. transport.c
  419. transport.h
  420. tree-diff.c
  421. tree-walk.c
  422. tree-walk.h
  423. tree.c
  424. tree.h
  425. unicode-width.h
  426. unimplemented.sh
  427. unix-socket.c
  428. unix-socket.h
  429. unpack-trees.c
  430. unpack-trees.h
  431. upload-pack.c
  432. upload-pack.h
  433. url.c
  434. url.h
  435. urlmatch.c
  436. urlmatch.h
  437. usage.c
  438. userdiff.c
  439. userdiff.h
  440. utf8.c
  441. utf8.h
  442. varint.c
  443. varint.h
  444. version.c
  445. version.h
  446. versioncmp.c
  447. walker.c
  448. walker.h
  449. wildmatch.c
  450. wildmatch.h
  451. worktree.c
  452. worktree.h
  453. wrap-for-bin.sh
  454. wrapper.c
  455. write-or-die.c
  456. ws.c
  457. wt-status.c
  458. wt-status.h
  459. xdiff-interface.c
  460. xdiff-interface.h
  461. zlib.c
README.md

Build status

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-<commandname>.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at https://lore.kernel.org/git/, http://marc.info/?l=git and other archival sites.

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks