工具
Git-
Python 3,需要add path
安裝
repo下載方式:
//C:\Users\賬戶名\bin
mkdir ~/bin
//添加path
PATH=~/bin:$PATH
//下載方式二選一
//1.谷歌
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
//2.清華鏡像:下載到當(dāng)前目錄,文件手動(dòng)復(fù)制到 C:\Users\賬戶名\bin 下
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
//設(shè)置權(quán)限
chmod a+x ~/bin/repo
//替換 repo 文件中 Url
舊:REPO_URL = 'https://gerrit.googlesource.com/git-repo'
新:REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
初始化
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-4.0.1_r1
repo sync
問題
1. PermissionError: [Errno 1]
...
File "H:\Work\.repo\repo\platform_utils_win32.py", line 172, in _create_symlink
raise OSError(errno.EPERM, error_desc, link_name)
PermissionError: [Errno 1] 客戶端沒有所需的特權(quán)。: 'H:\\Work\\.repo\\manifests\\.git'
錯(cuò)誤代碼:platform_utils_win32.py
def _create_symlink(source, link_name, dwFlags):
if not CreateSymbolicLinkW(
link_name,
source,
dwFlags | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE,
):
# See https://github.com/golang/go/pull/24307/files#diff-b87bc12e4da2497308f9ef746086e4f0 # noqa: E501
# "the unprivileged create flag is unsupported below Windows 10 (1703,
# v10.0.14972). retry without it."
if not CreateSymbolicLinkW(link_name, source, dwFlags):
code = get_last_error()
error_desc = FormatError(code).strip()
if code == ERROR_PRIVILEGE_NOT_HELD:
raise OSError(errno.EPERM, error_desc, link_name)
_raise_winerror(
code, 'Error creating symbolic link "{}"'.format(link_name)
)
原因
標(biāo)志 SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE 必須先在計(jì)算機(jī)上啟用開發(fā)人員模式才能正常工作。
2. repo版本更新

解決
- repo路徑下
.repo/repo(C盤和工程目錄)
$git status//查看狀態(tài)
$git pull//更新
仍然提示,則修改repo文件
VERSION = (2, 40)
↓
VERSION = (2, 42)
- 刪除repo文件,重新下載