欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

解决gRPC源码克隆速度慢的问题

程序员文章站 2023-12-25 11:23:09
...

一、遇到的问题

按照github上的说明进行操作

grpc/BUILDING.md at master · grpc/grpc
解决gRPC源码克隆速度慢的问题

Unix
 $ git clone -b v1.28.0-pre3 https://github.com/grpc/grpc
 $ cd grpc
 $ git submodule update --init

克隆最新release版本v1.28.0-pre3,但是克隆速度巨慢。
解决gRPC源码克隆速度慢的问题

二、解决办法

通过码云导入github地址之后克隆速度显著提升。

我已经将https://github.com/grpc/grpc导入我的码云仓库,可以直接克隆。

git clone aaa@qq.com:chenwr2020/grpc.git
git checkout -b grpc_v1.28.0-pre3 v1.28.0-pre3

克隆完毕之后再切换release版本tag分支,具体可以根据实际需求来选择分支。

在grpc目录下打开.gitmodules,默认为:

[submodule "third_party/zlib"]
    path = third_party/zlib
    url = https://github.com/madler/zlib
    # When using CMake to build, the zlib submodule ends up with a
    # generated file that makes Git consider the submodule dirty. This
    # state can be ignored for day-to-day development on gRPC.
    ignore = dirty
[submodule "third_party/protobuf"]
    path = third_party/protobuf
    url = https://github.com/google/protobuf.git
    branch = 3.0.x
[submodule "third_party/gflags"]
    path = third_party/gflags
    url = https://github.com/gflags/gflags.git
[submodule "third_party/googletest"]
    path = third_party/googletest
    url = https://github.com/google/googletest.git
[submodule "third_party/benchmark"]
    path = third_party/benchmark
    url = https://github.com/google/benchmark
[submodule "third_party/boringssl-with-bazel"]
    path = third_party/boringssl-with-bazel
    url = https://github.com/google/boringssl.git
[submodule "third_party/cares/cares"]
    path = third_party/cares/cares
    url = https://github.com/c-ares/c-ares.git
    branch = cares-1_12_0
[submodule "third_party/bloaty"]
    path = third_party/bloaty
    url = https://github.com/google/bloaty.git
[submodule "third_party/abseil-cpp"]
    path = third_party/abseil-cpp
    url = https://github.com/abseil/abseil-cpp.git
    branch = lts_2020_02_25
[submodule "third_party/envoy-api"]
    path = third_party/envoy-api
    url = https://github.com/envoyproxy/data-plane-api.git
[submodule "third_party/googleapis"]
    path = third_party/googleapis
    url = https://github.com/googleapis/googleapis.git
[submodule "third_party/protoc-gen-validate"]
    path = third_party/protoc-gen-validate
    url = https://github.com/envoyproxy/protoc-gen-validate.git
[submodule "third_party/udpa"]
    path = third_party/udpa
    url = https://github.com/cncf/udpa.git
[submodule "third_party/libuv"]
    path = third_party/libuv
    url = https://github.com/libuv/libuv.git

修改为

[submodule "third_party/zlib"]
	path = third_party/zlib
	url = aaa@qq.com:chenwr2020/zlib.git
	# When using CMake to build, the zlib submodule ends up with a
	# generated file that makes Git consider the submodule dirty. This
	# state can be ignored for day-to-day development on gRPC.
	ignore = dirty
[submodule "third_party/protobuf"]
	path = third_party/protobuf
	url = aaa@qq.com:chenwr2020/protobuf.git
	branch = 3.0.x
[submodule "third_party/gflags"]
	path = third_party/gflags
	url = aaa@qq.com:chenwr2020/gflags.git
[submodule "third_party/googletest"]
	path = third_party/googletest
	url = aaa@qq.com:chenwr2020/googletest.git
[submodule "third_party/benchmark"]
	path = third_party/benchmark
	url = aaa@qq.com:chenwr2020/benchmark.git
[submodule "third_party/boringssl-with-bazel"]
	path = third_party/boringssl-with-bazel
	url = gaaa@qq.com:chenwr2020/boringssl.git
[submodule "third_party/cares/cares"]
	path = third_party/cares/cares
	url = aaa@qq.com:chenwr2020/c-ares.git
	branch = cares-1_12_0
[submodule "third_party/bloaty"]
	path = third_party/bloaty
	url = aaa@qq.com:chenwr2020/bloaty.git
[submodule "third_party/abseil-cpp"]
	path = third_party/abseil-cpp
	url = aaa@qq.com:chenwr2020/abseil-cpp.git
	branch = lts_2020_02_25
[submodule "third_party/envoy-api"]
	path = third_party/envoy-api
	url = aaa@qq.com:chenwr2020/data-plane-api.git
[submodule "third_party/googleapis"]
	path = third_party/googleapis
	url = aaa@qq.com:chenwr2020/googleapis.git
[submodule "third_party/protoc-gen-validate"]
	path = third_party/protoc-gen-validate
	url = aaa@qq.com:chenwr2020/protoc-gen-validate.git
[submodule "third_party/udpa"]
	path = third_party/udpa
	url = aaa@qq.com:chenwr2020/udpa.git
[submodule "third_party/libuv"]
	path = third_party/libuv
	url = aaa@qq.com:chenwr2020/libuv.git

git submodule update --init 会克隆一些子模块仓库。自动安装这些第三方模块仓库还是很慢,我已经将第三方模块的仓库都导入我的码云仓库。
解决gRPC源码克隆速度慢的问题
解决gRPC源码克隆速度慢的问题
速度提升不止一个档次。

三、码云导入github

登录码云注册账号。

解决gRPC源码克隆速度慢的问题

解决gRPC源码克隆速度慢的问题
导入成功后
解决gRPC源码克隆速度慢的问题

解决gRPC源码克隆速度慢的问题

之后克隆显示需要添加公钥。
解决gRPC源码克隆速度慢的问题
在你要添加的机器中获取自己原先github生成的**。
具体如何生成可以参考博客:
ubuntu14.04 Git Github环境搭建设置_chenwr2018的博客-CSDN博客

解决gRPC源码克隆速度慢的问题

将上述文件获取的内容复制粘贴后生成公钥。
解决gRPC源码克隆速度慢的问题
解决gRPC源码克隆速度慢的问题
到此就可以愉快的克隆了。
解决gRPC源码克隆速度慢的问题

相关标签: gRPC

上一篇:

下一篇: