Preface
本文是对git config
部分参数的一点介绍。
最好的教程就是man git config
。
1 | -e, --edit |
git config -e
, 就是对配置文件进行编辑。
这里还有几个参数,分别是--local
, --global
, --system
,1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19# git config -e --local
# git config -e --global
# git config -e --system
--local
For writing options: write to the repository .git/config file. This is the default behavior.
For reading options: read only from the repository .git/config rather than from all available files.
See also the section called “FILES”.
--global
For writing options: write to global ~/.gitconfig file rather than the repository .git/config, write to $XDG_CONFIG_HOME/git/config file if this file
exists and the ~/.gitconfig file doesn’t.
For reading options: read only from global ~/.gitconfig and from $XDG_CONFIG_HOME/git/config rather than from all available files.
See also the section called “FILES”.
--system
For writing options: write to system-wide $(prefix)/etc/gitconfig rather than the repository .git/config.
For reading options: read only from system-wide $(prefix)/etc/gitconfig rather than from all available files.
See also the section called “FILES”.
简单总结下,--local
是修改.git/config
,--global
是修改 ~/.gitconfig
,--system
是修改 /etc/gitconfig
.分别是仓库的配置文件,当前用户的配置文件,本机的配置文件。
git config -e
等同于 git config -e --local
优先级是git config > git config --global > git config --system
,因为配置文件是就近查找的,如果没有,再向外查找配置文件。
如果Github没有记录上你的Contributions,可能就是因为你的用户名或者邮箱跟github没有关联上,github认为不是你提交的,不统计。
对当前仓库做设置
1 | git config --local user.name "Sail" |