git全局设置,下载大型项目

本文介绍了在使用gitclone下载大型项目时可能遇到的问题,提供了解决方案,包括设置LF/CRLF、压缩级别、HTTP超时、缓存和代理等gitconfig参数,以及如何查看和管理这些配置。
摘要由CSDN通过智能技术生成

问题背景

当使用git clone下载大型项目的时候,有时候会有到一些问题,因此,需要提前设置好git的相关参数,便于下载源码研究学习

问题解决

 #  格式化换行符 
 #      1.true: 提交时改成LF,检出时改成CRLF 
 #      2.input:提交时改成LF,检出时不改 
 #      3.false:提交时是什么就是什么,不改换行符,检出时也不改 
 git config --global core.autocrlf input
 #设置压缩级别 0表示无压缩,-1为zlib默认压缩值,而1-9是速度大小集中的方案,最慢的是9
 git config --global core.compression -1
 #http超时设置:传输速率低于0才满足超时条件1
 git config --global http.lowSpeedLimit 0
 #http超时设置:传输时间超过999999s满足超时条件2。当条件1和2都满足后才会timeout
 git config --global http.lowSpeedTime 999999
 #设置缓存5G
 git config --global http.postBuffer 5242880000
 git config --global https.postBuffer 5242880000
 #设置代理
 git config --global http.proxy 127.0.0.1:7890
 git config --global https.proxy 127.0.0.1:7890
 #取消代理
 git config --global --unset http.proxy
 git config --global --unset https.proxy

git config大概说明:

usage: git config [<options>]

Config file location
    --[no-]global         use global config file 
    --[no-]system         use system config file 
    --[no-]local          use repository config file 
    --[no-]worktree       use per-worktree config file 
    -f, --[no-]file <file>
                          use given config file 
    --[no-]blob <blob-id> read config from given blob object 

Action
    --[no-]get            get value: name [value-pattern]
    --[no-]get-all        get all values: key [value-pattern]
    --[no-]get-regexp     get values for regexp: name-regex [value-pattern]
    --[no-]get-urlmatch   get value specific for the URL: section[.var] URL
    --[no-]replace-all    replace all matching variables: name value [value-pattern]
    --[no-]add            add a new variable: name value
    --[no-]unset          remove a variable: name [value-pattern]
    --[no-]unset-all      remove all matches: name [value-pattern]
    --[no-]rename-section rename section: old-name new-name
    --[no-]remove-section remove a section: name
    -l, --[no-]list       list all
    --[no-]fixed-value    use string equality when comparing values to 'value-pattern'
    -e, --[no-]edit       open an editor
    --[no-]get-color      find the color configured: slot [default]
    --[no-]get-colorbool  find the color setting: slot [stdout-is-tty]

Type
    -t, --[no-]type <type>
                          value is given this type
    --bool                value is "true" or "false"
    --int                 value is decimal number
    --bool-or-int         value is --bool or --int
    --bool-or-str         value is --bool or string
    --path                value is a path (file or directory name)
    --expiry-date         value is an expiry date

Other
    -z, --[no-]null       terminate values with NUL byte
    --[no-]name-only      show variable names only
    --[no-]includes       respect include directives on lookup
    --[no-]show-origin    show origin of config (file, standard input, blob, command line)
    --[no-]show-scope     show scope of config (worktree, local, global, system, command)
    --[no-]default <value>
                          with --get, use default value when missing entry

详细配置帮助请使用:git config --help

  • 15
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值