git clone下载时遇到的问题解决

在下载代码时遇到过两次同样的问题,因此特将解决办法在此记录下去,希望可以帮助也有共同困扰的小伙伴!

在git clone下载代码时遇到如下错误:
Username for 'https://github.com': Newbie
Password for 'https://[email protected]':
Counting objects: 11507, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8210/8210), done.
Writing objects: 100% (11506/11506), 21.75 MiB | 0 bytes/s, done.
Total 11506 (delta 2213), reused 11504 (delta 2211)
efrror: RPC failed; result=56, HTTP code = 200
atal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

在百度之后有如下两种解决方式:

第一次用下列方式解决:

引起原因:


            Cause #1 git debug output has error: RPC failed; result=56, HTTP code = 200
                 Error code 56 indicates a curl receive error of CURLE_RECV_ERROR which means there was some issue that prevented the data from being received during the clone process. 
Typically this is caused by a network setting, firewall, VPN client, or anti-virus that is terminating the connection before all data has been transferred.
(网络设置,防火墙,VPN客户端,反病毒(在数据传输完成之前会使其终止))

           Cause #2 There is no error code and git debug log shows that Nginx is configured as reverse proxy. Git clone fails after 1 GB.
                e.g.

              < HTTP/1.1 200
              < Server: nginx/1.10.2

    解决办法:(在运行的git命令的路径下运行下列命令)
             On Linux

              Execute the following in the command line before executing the Git command:

                                export GIT_TRACE_PACKET=1
                                export GIT_TRACE=1
                                export GIT_CURL_VERBOSE=1

           On Windows

                     Execute the following in the command line before executing the Git command:

                                 set GIT_TRACE_PACKET=1
                                 set GIT_TRACE=1
                                  set GIT_CURL_VERBOSE=1

但是第二次遇到同样问题的时候上述方法依旧解决不了,再次寻找解决办法,如下:

The problem is most likely because your git buffer is too low.

You will need to increase Git’s HTTP buffer by setting the git config var “http.postBuffer” to 524288000.

git config --global http.postBuffer 524288000

此命令要运行在git 环境下

你可能感兴趣的:(linux学习)