how_to_clone_apollo_repo_from_china.md 2.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
# How to Clone Apollo Repository from China

This document describes a smarter approach to clone Apollo repository for users
from China.

## Pre-requisites

- Suppose you have forked Apollo Repository on GitHub. This is done by clicking
  the "Fork" button on the top-right of
  [Apollo's Github Page](https://github.com/ApolloAuto/apollo.git) and follow
  the instructions there.

## First, clone Apollo from Gitee

Apollo on Gitee was about one month later than Apollo on GitHub. We can use it
as a good start.

```bash
git clone https://gitee.com/baidu/apolloauto.git apollo
```

This step takes only serveral minutes, as the download rate can reach up-to >
10MiB/s tested on my machine with

the following console log:

```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.
```

## Reset origin to your GitHub fork

```bash
git remote set-url origin git@github.com:YOUR_GITHUB_USERNAME/apollo.git
```

## Set Apollo GitHub repo as upstream

```bash
# Using SSH
git remote add upstream git@github.com:ApolloAuto/apollo.git

# Using HTTPS
git remote add upstream https://github.com/ApolloAuto/apollo.git
```

You can confirm that the origin/upstream has been setup correctly by running:

```bash
git remote -v
```

It will show the list of remotes similar to the following:

```text
origin	git@github.com:YOUR_GITHUB_USERNAME/apollo.git (fetch)
origin	git@github.com:YOUR_GITHUB_USERNAME/apollo.git (push)
upstream	git@github.com:ApolloAuto/apollo.git (fetch)
upstream	git@github.com:ApolloAuto/apollo.git (push)
```

## Pull latest code from GitHub upstream

```bash
git pull --rebase upstream master
```

You can follow this guide on
[How to Workaround Slow Pull from CN](how_to_solve_slow_pull_from_cn.md).

## Congrats!

You have successfully cloned Apollo repository. Good luck to your journey of
autonomous driving with Apollo!