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你叫我情何以堪?
扫描公众号,关注更多信息
---------------------------------------------------------------------------------我是分割线--------------------------------------------------------------------------
to be a better me, talk is cheap show me the code
文中有不妥或者错误的地方还望指出,以免误人子弟。如果觉得本文对你有所帮助不妨【推荐】一下!如果你有更好的建议,可以给我留言讨论,共同进步!
再次感谢您耐心的读完本篇文章。
----------------------------------------------------------------------------------------------------------------------------------------------------------------------