Home > Development Tools > git > body text

What to do if git cloning fails

藏色散人
Release: 2021-11-29 16:28:19
Original
21163 people have browsed it

Solution to git cloning failure: 1. Execute the "git config --global http.postBuffer 524288000" command; 2. Add the IP address to /etc/hosts; 3. Refresh the dns cache.

What to do if git cloning fails

The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.

What should I do if git cloning fails?

Using git to clone the project on github failed

Phenomena

When using git clone nextjs demo project source code today, git clone https: //github.com/XXXX/next-blog.git The download speed is very slow, and then after downloading for a while, the following error message is always prompted

nCloning into 'next-blog'...
remote: Enumerating objects: 111, done.
remote: Counting objects: 100% (111/111), done.
remote: Compressing objects: 100% (83/83), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Copy after login

Reason

Due to Http There is a protocol error when pulling or cloning, or it is caused by a CDN on github being blocked by a great wall.

Solution

Protocol error

  1. Execute the following command first

    git config --global http.postBuffer 524288000
    Copy after login
  2. Then execute the git pull or git clone command

Wall Shield

  1. Visit http://github.global.ssl.fast...
    Get the cdn domain name and IP address
  2. Visit http://github.com.ipaddress.c... Obtain the cdn domain name and IP address
    What to do if git cloning fails
  3. Add the IP address obtained above to /etc/hosts

    sudo vim /etc/hosts
    Copy after login

    What to do if git cloning fails

  4. ##Refresh dns cache

    sudo killall -HUP mDNSResponder
    sudo dscacheutil -flushcache
    Copy after login
Result

When I executed the git clone operation again, the speed increased rapidly, reaching hundreds of Kb at once~

Recommended study: "

Git tutorial

The above is the detailed content of What to do if git cloning fails. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
git
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!