git无法clone远程代码库及git代理设置


  git作为一个版本管理神器,日常工作中自然也就少不了了;特别是Android开发,github和google是逃不过的了。然而很多时候需要用到git克隆远程的代码库,众所周知的原因google、android官网都是无法访问的。那么我们怎么克隆诸如:android.googlesource.com下的库呢?

  工具:git、vpn代理

  实例:git clone https://android.googlesource.com/platform/frameworks/volley/

D:\AndroidStudioProjects> git clone https://android.googlesource.com/platform/frameworks/volley/
Cloning into 'volley'...
fatal: unable to access 'https://android.googlesource.com/platform/frameworks/volley/': Failed connect to android.googlesource.com:443; No error

  Failed connect to android.googlesource.com:443这很明显是由于被墙了。那么怎么办呢?首先想到的是VPN,前提是你需要有一个VPN。

  设置git代理

git config --global http.proxy "localhost:1080"

  再次运行

git clone https://android.googlesource.com/platform/frameworks/volley/

  此时可以看到如下结果

D:\AndroidStudioProjects> git clone https://android.googlesource.com/platform/frameworks/volley/
Cloning into 'volley'...
remote: Counting objects: 81, done
remote: Finding sources: 100% (81/81)
Receiving objects: 100% (2953/2953), 1.16 MiB | 23.00 KiB/s, done.
remote: Total 2953 (delta 263), reused 2953 (delta 263)R/263)
Resolving deltas: 100% (263/263), done.
Checking connectivity... done.

  Android开发,没有VPN你叫我情何以堪?


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM