git命令之git config

关于git config命令

git config命令是对git进行一些配置,这些配置是写在配置文件里的,所以其实git config命令等价于直接修改对应的配置文件,那么有哪些配置文件呢:

  • 仓库级配置文件:在当前仓库根路径下的.git隐藏文件夹,文件名为config
  • 用户级配置文件:一般在C:\Users\Admin路径下,文件名为.gitconfig
  • 系统级配置文件:在本地git的安装目录下,如D:\Git\mingw64\etc,文件名为gitconfig

仓库级配置文件只对当前所在仓库有效,仓库级配置优先级最高,用户级配置次之,系统级配置优先级最低。

查看配置信息

// 查看仓库配置
git config --local -l

// 查看用户配置
git config --global -l

// 查看系统配置
git config --system -l

// 查看所有的配置信息,依次是系统级别、用户级别、仓库级别
git config -l

代理的配置及取消

开启代理可以加快拉代码的速度,否则真的是慢的一批…配置如下:

// 设置socks5代理
git config --global http.proxy "socks5://127.0.0.1:1080"
git config --global https.proxy "socks5://127.0.0.1:1080"

// 设置http代理
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

// 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
发布了63 篇原创文章 · 获赞 131 · 访问量 36万+

猜你喜欢

转载自blog.csdn.net/u012043391/article/details/104578215