2016-04-27 57 views
0

我試圖建立一些git的別名,發現一個奇怪的事情有關git config爲什麼'git config'在某些情況下會創建多個配置項?

$ git config user.name foo  # this stores the new name, ok 
$ git config user.name bar baz # this adds a 'name = bar' entry to the config, wtf? 
$ git config user.name qux 
warning: user.name has multiple values 
error: cannot overwrite multiple values with a single value 
Use a regexp, --add or --replace-all to change user.name. 

我不知道爲什麼混帳存儲多個值,在第二種情況,當它可能是有用的?

回答

1

我有這個在我的混帳配置:

[include] 
    path = ~/.gitconfig_user 
    path = ~/.gitconfig_os 

,讓我從外部文件的Git配置的塊組成我的配置。我猜測,爲了保持一致性,Git允許您爲任意鍵指定多個值,但它們只對特定的一組用戶有意義。

相關問題