From 1b8803cc9f7098356454c72d34dc535c6dc4fe49 Mon Sep 17 00:00:00 2001 From: storypku Date: Fri, 16 Oct 2020 10:20:57 +0800 Subject: [PATCH] Docs: added Chinese version of How To Clone Apollo Repo from China --- docs/howto/README.md | 3 +- ...=> how_to_clone_apollo_repo_from_china.md} | 0 .../how_to_clone_apollo_repo_from_china_cn.md | 78 +++++++++++++++++++ .../apollo_software_installation_guide.md | 2 +- .../apollo_software_installation_guide_cn.md | 2 +- 5 files changed, 82 insertions(+), 3 deletions(-) rename docs/howto/{how_to_clone_apollo_repo_from_cn.md => how_to_clone_apollo_repo_from_china.md} (100%) create mode 100644 docs/howto/how_to_clone_apollo_repo_from_china_cn.md diff --git a/docs/howto/README.md b/docs/howto/README.md index 429d81ee38..352fa6b088 100644 --- a/docs/howto/README.md +++ b/docs/howto/README.md @@ -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) diff --git a/docs/howto/how_to_clone_apollo_repo_from_cn.md b/docs/howto/how_to_clone_apollo_repo_from_china.md similarity index 100% rename from docs/howto/how_to_clone_apollo_repo_from_cn.md rename to docs/howto/how_to_clone_apollo_repo_from_china.md diff --git a/docs/howto/how_to_clone_apollo_repo_from_china_cn.md b/docs/howto/how_to_clone_apollo_repo_from_china_cn.md new file mode 100644 index 0000000000..639c1cad20 --- /dev/null +++ b/docs/howto/how_to_clone_apollo_repo_from_china_cn.md @@ -0,0 +1,78 @@ +# 国内环境下如何克隆 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 自动驾驶之旅! + diff --git a/docs/quickstart/apollo_software_installation_guide.md b/docs/quickstart/apollo_software_installation_guide.md index ace384cf73..7048c9f5dc 100644 --- a/docs/quickstart/apollo_software_installation_guide.md +++ b/docs/quickstart/apollo_software_installation_guide.md @@ -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 diff --git a/docs/quickstart/apollo_software_installation_guide_cn.md b/docs/quickstart/apollo_software_installation_guide_cn.md index c61fda165d..c404126c57 100644 --- a/docs/quickstart/apollo_software_installation_guide_cn.md +++ b/docs/quickstart/apollo_software_installation_guide_cn.md @@ -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`: -- GitLab