git config

2020-02-10  本文已影响0人  emm_simon

[参考link]
[参考w3cschool git config link]

执行git config -lorvim ~/.gitconfig可以查看当前的git配置。

-1- global git配置 vs 项目专属git配置

-2- name、email配置

-3- 常用命令alias别名

-4- http、https配置

配置项 可选配置 功能
http.proxy
http.proxyAuthMethod
http.emptyAuth
http.delegation
http.extraHeader
http.cookieFile
http.saveCookies
http.sslVersion
http.sslCipherList
http.sslVerify
http.sslCert
http.sslKey
http.sslCertPasswordProtected
http.sslCAInfo
http.sslCAPath
http.pinnedpubkey
http.sslTry
http.maxRequests
http.minSessions
http.postBuffer 524288000\approx500M git clone or git pull 时,如果
报错: early EOF index-pack failed
可以通过设置较大的postBuffer来解决
http.lowSpeedLimit
http.lowSpeedTime
http.noEPSV
http.userAgent
http.followRedirects
http.<url>.*
-4.1- postBuffer

应对场景:git clone or git pull时,如果项目文件过大,会出现early EOF index-pack failed的问题,可以通过设置较大的http.postBuffer来解决此类问题:
git config命令修改配置:

git config --global http.postBuffer 524288000
-4.2- proxy

[设置代理参考link]
应对场景:git clone or git pull时,获取代码的时候有时候很慢,可以通过设置修改https.proxy来解决此类问题:
git config命令修改配置:

http代理:
git config --global https.proxy http://127.0.0.1:10800
git config --global https.proxy https://127.0.0.1:10800
socks5代理:
git config --global http.proxy 'socks5://127.0.0.1:10800'
git config --global https.proxy 'socks5://127.0.0.1:10800'
取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy

vim ~/.gitconfig修改配置:

[http]
proxy = socks5://127.0.0.1:10800
[https]
proxy = socks5://127.0.0.1:10800
-4.3- sslVerify、cookieFile

git config命令修改配置:

% git config --bool --get-urlmatch http.sslverify https://good.example.com
true
% git config --bool --get-urlmatch http.sslverify https://weak.example.com
false
% git config --get-urlmatch http https://weak.example.com
http.cookieFile /tmp/cookie.txt
http.sslverify false
git config --bool --get-urlmatch http.sslverify https://github.com false

vim ~/.gitconfig修改配置:

[http "https://weak.example.com"]
        sslVerify = false
        cookieFile = /tmp/cookie.txt
[http "https://github.com"]
        sslVerify = false
        cookieFile = /tmp/cookie.txt
上一篇 下一篇

猜你喜欢

热点阅读