.gitconfig中的[core]做了什么,以及如何设置它?

时间:2013-03-03 16:18:03

标签: git git-config

我想知道[核心]做了什么,以及如何设置它。我发现我的主目录中的.gitconfig文件是这样的:

[core]
        autocrlf = input
        safecrlf = true

[user]
        name =  
        email = 

在另一个主目录中,它看起来像这样:

[user]
        name =
        email = 
[core]
        excludesfile = /Users/chenfl84/.gitignore_global
[difftool "sourcetree"]
        cmd = opendiff \"$LOCAL\" \"$REMOTE\"
        path =
[mergetool "sourcetree"]
        cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
        trustExitCode = true

2 个答案:

答案 0 :(得分:5)

每个[section]开始一个包含值的部分。您可以手动编辑文件,也可以使用git config,例如

git config --global core.name Pippi  # < value
#            section ^     ^ key

git help config有一个选项列表。

答案 1 :(得分:5)

请参阅git-config(1)手册页,或运行git help config以获取有关如何安排Git配置的一般信息。

[core]部分指的是控制Git行为“核心”的事物:文件和文件的内容。更新被识别,缓存,压缩,。,

默认值通常是 - 只是总是 - 你想要什么,但由于很多人想要自定义*crlf选项,它们已被明确地放在一个方便的地方改变。