git配置有system,global蛹含,local三個級別毅厚,如果三個里面都配置了相同的參數(shù),那優(yōu)先級為local > global > system浦箱。
1. 查看配置項(xiàng)
命令參數(shù) –list, 簡寫 -l
格式:git config [–local|–global|–system] -l
查看倉庫級的config吸耿,:git config –local -l
查看全局級的config,:git config –global -l
查看系統(tǒng)級的config酷窥,:git config –system -l
查看倉庫級的config
2. 增加配置項(xiàng)
參數(shù) –add
格式: git config [–local|–global|–system] –add section.key value(默認(rèn)是添加在local配置中)
例如咽安,給本地倉庫添加一個遠(yuǎn)程倉庫地址
git config --add remote.top git@xxxxxxxxxxx.git
增加配置項(xiàng)
3. 刪除配置項(xiàng)
命令參數(shù) –unset
格式:git config [–local|–global|–system] –unset section.key
git config --local --unset tomcat.name
git config --local --unset-all tomcat.name
刪除配置項(xiàng)
4。獲取指定的配置信息
命令參數(shù) –get
格式:git config [–local|–global|–system] –get section.key(默認(rèn)是獲取local配置中內(nèi)容)
git config --get tomcat.name
獲取配置信息