MENU

安装Git-Repo工具

July 2, 2020 • Read: 5245 • • 阅读设置

安装Git-Repo工具

Git-Repo工具


单项目多Git仓库管理神器,安卓源码项目(AOSP)就是用这货管理的(几百个Git仓库组成)。


官方github地址 https://github.com/GerritCodeReview/git-repo


本教程全部使用清华TUNA镜像源,无需访问Google服务器。

安装Git-Repo

MacOS

# MacOS
brew install repo

Window

# 预先安装 python3.7
# 预先安装 Git-windows

# 右键打开git-bash终端运行

curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o ~/bin/repo
chmod +x repo


# 测试(git-bash)
repo -h

# 需要管理员权限才能运行repo init,不然会报symbolic link 错误
# 建议使用管理员运行git-bash
# 不太建议使用管理员运行IDE 启动git-bash

Linux

# Debian/Ubuntu.
sudo apt-get install repo

# other Linux
# Make sure git is installed.
git --version
# install repo
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o /usr/local/bin/repo
chmod a+rx /usr/local/bin/repo

# 测试
repo -h

使用Repo


repo 其实只是个启动工具,大部分核心代码会在repo init的时候下载到项目.repo目录内。。。
所以还需加速。

# 使用TUNA镜像
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'

# 执行repo init
repo init -u https://demo.com/demo-repo-manifest.git




Last Modified: July 13, 2020