提交 1b8803cc 编写于 作者: S storypku 提交者: Liu Jiaming

Docs: added Chinese version of How To Clone Apollo Repo from China

上级 effcbc35
......@@ -63,8 +63,9 @@
## Others
- [How to generate and push images into Docker](how_to_generate_and_push_docker_images.md)
- [How to clone Apollo repository from CN](how_to_clone_apollo_repo_from_cn.md)
- [How to clone Apollo repository from China](how_to_clone_apollo_repo_from_china.md)
### Chinese versions
- [How to generate and push images into Docker](how_to_generate_and_push_docker_images_cn.md)
- [国内环境下如何克隆Apollo 仓库](how_to_clone_apollo_repo_from_china_cn.md)
- [How to solve slow pull from CN](how_to_solve_slow_pull_from_cn.md)
# 国内环境下如何克隆 Apollo 仓库
本文档描述了在国内环境下既快又好地克隆Apollo 仓库的方法。
## 必要前提/准备
- 假设你已经 「fork」 了GitHub上的Apollo 代码库。这可以通过点击[GitHub上的 Apollo](https://github.com/ApolloAuto/apollo.git) 页面右上角的「Fork」按钮并遵照随后的提示来完成。
## 首先,从码云上克隆 Apollo 仓库
[码云上的 Apollo仓库](https://gitee.com/baidu/apolloauto.git) 通常比[GitHub上的 Apollo仓库](https://github.com/ApolloAuto/apollo.git) 更新晚一个月左右。
我们可以以它为起点,克隆码云上的Apollo 仓库。
执行命令:
```bash
git clone https://gitee.com/baidu/apolloauto.git apollo
```
这一步通常很快,只需十数分钟。在本文作者所在的百度内部,下载速度可达 10 多 MiB/s,终端输出如下:
```text
Cloning into 'apollo'...
remote: Enumerating objects: 313277, done.
remote: Counting objects: 100% (313277/313277), done.
remote: Compressing objects: 100% (66199/66199), done.
remote: Total 313277 (delta 245822), reused 310653 (delta 243198), pack-reused 0
Receiving objects: 100% (313277/313277), 2.19 GiB | 11.10 MiB/s, done.
Resolving deltas: 100% (245822/245822), done.
Checking out files: 100% (9124/9124), done.
```
## 重置远程分支origin
上述步骤完成后,就可以「过河拆桥」,将远程分支 origin 重置为你刚 「fork」的GitHub 分支。
```bash
git remote set-url origin git@github.com:<你的GitHub 用户名>/apollo.git
```
## 将 GitHub 上的 Apollo 仓库设为远程分支upstream
```bash
# 采用SSH的方式
git remote add upstream git@github.com:ApolloAuto/apollo.git
# 采用HTTPS的方式
git remote add upstream https://github.com/ApolloAuto/apollo.git
```
你可以运行如下命令来确认远程分支 origin 和 upstream 已被正确设置:
```bash
git remote -v
```
如果之前的操作正确,它将列出如下的远端分支:
```text
origin git@github.com:<你的GitHub 用户名>/apollo.git (fetch)
origin git@github.com:<你的GitHub 用户名>/apollo.git (push)
upstream git@github.com:ApolloAuto/apollo.git (fetch)
upstream git@github.com:ApolloAuto/apollo.git (push)
```
## 现在,从 GitHub 远程分支upstream 拉取最新的「增量」代码
```bash
git pull --rebase upstream master
```
如果遇到问题,你可以参考这篇文档:[如何解决国内拉取 GitHub仓库太慢的问题](how_to_solve_slow_pull_from_cn.md).
## 结语
恭喜你成功地克隆了 Apollo Gitee/GitHub 仓库,并由此开启你的 Apollo 自动驾驶之旅!
......@@ -35,7 +35,7 @@ git checkout master
```
For CN users, please refer to
[How to Clone Apollo Repository from CN](../howto/how_to_clone_apollo_repo_from_cn.md)
[How to Clone Apollo Repository from China](../howto/how_to_clone_apollo_repo_from_china.md)
if your have difficulty cloning from GitHub.
(Optional) For convenience, you can set up environment variable
......
......@@ -28,7 +28,7 @@ cd apollo
git checkout master
```
对于中国用户, 如果你难以从GitHub克隆,请参考[如何在中国克隆Apollo仓库](../howto/how_to_clone_apollo_repo_from_cn.md)
对于中国用户, 如果从GitHub克隆仓库有困难,可参考[国内环境下如何克隆Apollo仓库](../howto/how_to_clone_apollo_repo_from_china_cn.md)
(可选)为方便起见,可以在Apollo的根目录运行以下命令来设置指向该目录的环境变量`APOLLO_ROOT_DIR`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册