git config 查看,设置,删除项

查看所有项

git config --list

比如执行后如下

$ git config --list diff.astextplain.textconv=astextplain filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true http.sslbackend=openssl http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt core.autocrlf=true core.fscache=true core.symlinks=false pull.rebase=false credential.helper=manager-core credential.https://dev.azure.com.usehttppath=true

删除某项

git config --global --unset key(=号前面得就是key)

比如我要删除 credential.helper=manager-core,需要执行:

git config --global --unset credential.helper

设置某项(添加或者修改)

git config --global key value

比如我要添加 http.version HTTP/1.1,需要执行:

git config --global http.version HTTP/1.1

执行完后查看,会发现多了http.version 的项:

git config --list
经验分享 程序员 微信小程序 职场和发展