Git 拉取 Github 指定分支

文章目录

    在拉取 Github 指定分支时又遇到了问题

    正常的操作

    # 1. 只拉取目标分支(数据量小,成功率高)
    git fetch github some_branch
    
    # 2. 基于刚拉下来的远程跟踪引用创建并切换本地分支
    git checkout -b some_branch github/some_branch
    

    报错 invalid index-pack output

    > git fetch github some_branch
    remote: Enumerating objects: 279, done.
    remote: Counting objects: 100% (277/277), done.
    remote: Compressing objects: 100% (154/154), done.
    error: RPC failed; curl 56 OpenSSL SSL_read: OpenSSL/3.5.9: error:0A000119:SSL routines::decryption failed or bad record mac, errno 0
    error: 8217 bytes of body are still expected
    fetch-pack: unexpected disconnect while reading sideband packet
    fatal: early EOF
    fatal: fetch-pack: invalid index-pack output
    

    无效的配置

    尝试了各种配置,都没有效果,以下都是无效的配置:

    git config --global http.postBuffer 524288000
    git config --global http.version HTTP/1.1
    git -c http.version=HTTP/1.1 -c http.sslVersion=tlsv1.2 fetch github some_branch
    

    解决方法

    去掉代xxx理配置后正常

    参考之前配置好了 国内 git push 到 github 的配置。

    去掉 ~/.gitconfig 中针对 github 的配置即可。