注冊碼雲賬戶,配置SSH公鑰,配置Git,這些步驟以前做過,不再描述,可以看官方教程。
1 安裝repo
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo
chmod a+x /usr/local/bin/repo
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
2 下載源碼
mkdir openharmony
cd openharmony
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c -j2
我用1.0版本
repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony-1.0
10分鍾左右下完。1.64GB。
報錯
- Mac拉取源碼,報錯
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
Downloading Repo source from https://gitee.com/oschina/repo.git
fatal: Cannot get https://gitee.com/oschina/repo.git/clone.bundle
fatal: error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)
fatal: cloning the git-repo repository failed, will remove '.repo/repo'
原因是mac的python3.6使用自帶的openssl,需要安裝證書。
解:
open /Applications/Python\ 3.6/Install\ Certificates.command
參考:
https://stackoverflow.com/a/61818074/7996308
- 用清華的repo會有一些錯誤,要改用gitee的repo。
參考
get-code/源碼獲取.md · OpenHarmony/docs - Gitee.com
https://gitee.com/openharmony/docs/blob/master/get-code/源碼獲取.md