新 git 存储库的默认配置设置? [英] Default config settings for a new git repository?

查看:19
本文介绍了新 git 存储库的默认配置设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

解决方案

考虑git init:

 --template=

<块引用>

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

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

如果您查看 创建新数据库的 git 源代码,您可以在其中包含一个带有默认值的配置文件.

函数create_default_files()确实有:

/* 首先复制模板——我们可能有默认的* 配置文件在那里,在这种情况下我们想要阅读* 安装后从它.*/复制模板(模板路径);

git/config.cgit_default_core_config() 设置默认值的函数.

When I create a new git repository, some configurations settings are automatically added to .git/config. Where can I change these default settings?

解决方案

Considering the option template of git init:

 --template=<template_directory>

Provide the directory from which templates will be used. The default template directory is /usr/share/git-core/templates.

When specified, <template_directory> is used as the source of the template files rather than the default.
The template files include some directory structure, some suggested "exclude patterns", and copies of non-executing "hook" files. The suggested patterns and hook files are all modifiable and extensible.

If you look at the git sources for creating a new db, you could include a config file with your default value there.

The function create_default_files() does have:

 /* 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);

The git/config.c has the git_default_core_config() function which set default values.

这篇关于新 git 存储库的默认配置设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆