Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
568 views
in Technique[技术] by (71.8m points)

configuration - Default config settings for a new git repository?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...