新git存储库的默认配置设置?

cis*_*eat 18 git configuration

当我创建一个新的git存储库时,一些配置设置会自动添加到.git/config中.我在哪里可以更改这些默认设置?

Von*_*onC 13

考虑以下选项模板git init:

 --template=<template_directory>
Run Code Online (Sandbox Code Playgroud)

提供将使用模板的目录.默认模板目录是/usr/share/git-core/templates.

指定时,<template_directory>用作模板文件的源而不是默认值.
模板文件包括一些目录结构,一些建议"排除模式",以及非执行"钩子"文件的副本.建议的模式和钩子文件都是可修改和可扩展的.

如果你查看用于创建新数据库的git源,你可以在那里包含一个带有默认值的配置文件.

功能 create_default_files()确实有:

 /* First copy the templates -- we might have the default
  * config file there, in which case we would want to read
  * from it after installing.
  */
copy_templates(template_path);
Run Code Online (Sandbox Code Playgroud)

混帐/ config.cgit_default_core_config()其设置的默认值的功能.

  • 我在“ [core]”部分添加了一个文件“ / usr / share / git-core / templates / config”,其中“ filemode = false”和一个随机的“ xyz = foo”。`xyz = foo`可以工作,但是由于上面提到的硬编码逻辑,`filemode = false`被覆盖了。 (3认同)