2012-08-16 101 views

回答

3

无论您运行命令的顺序如何,您都将在repo1和Jill中为repo2。从git config手册页:

If not set explicitly with --file, there are four files where git config will search for configuration options: 

    $GIT_DIR/config 
     Repository specific configuration file. 

    ~/.gitconfig 
     User-specific configuration file. Also called "global" configuration file. 

    $XDG_CONFIG_HOME/git/config 
     Second user-specific configuration file. If $XDG_CONFIG_HOME is not set or empty, $HOME/.config/git/config will be used. Any single-valued variable 
     set in this file will be overwritten by whatever is in ~/.gitconfig. It is a good idea not to create this file if you sometimes use older versions of 
     Git, as support for this file was added fairly recently. 

    $(prefix)/etc/gitconfig 
     System-wide configuration file. 

Git按此顺序加载这些文件。您的本地存储库.git/config的优先级高于~/.gitconfig,优先于$HOME/.config/git/config,优先于/etc/gitconfig。此外:

All writing options will per default write to the repository specific configuration file. Note that this also affects options like --replace-all and 
--unset. git config will only ever change one file at a time. 

--global标志不改变每.git/config您的系统上,只是~/.gitconfig

+0

完美,感谢的人:) – necrosmash 2012-08-16 12:13:28

相关问题