Ubuntu 配置repo环境

一.  前言

        下载Android源码的时候,自己的Ubuntu电脑需要初始化repo环境,这样子你就可以使用 repo init  -u ssh:       repo sync 等命令下载代码, 在工作中,一般公司的代码仓 git-repo 是固定的,首次就需要把repo的初始化环境配置好,比较简单,随笔记录一下。

二. 配置步骤

1. 从清华镜像网站下载 git-repo

git clone https://mirrors.tuna.tsinghua.edu.cn/git/git-repo

2. 根目录下创建.bin文件夹

mkdir ~/.bin

3. 拷贝git-repo文件夹中的repo 到  ~/.bin 目录下

cp git-repo/repo ~/.bin/

4. 添加执行权限

sudo chmod a+x ~/.bin/repo

5. 配置环境

export PATH=~/.bin:$PATH
echo "export PATH=~/.bin:$PATH">> ~/.bashrc

6. 配置下载代码repo地址环境

export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
echo "export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'">> ~/.bashrc

三. 检查环境并下载源码

1. 执行命令查看是否配置ok

vi ~/.bashrc

可以在文件的最尾部可以看到如下,说明配置成功

export PATH=~/.bin:/home/xx/.bin: 
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

2. 下载google源码,比如下载Android11源码

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-11.0.0_r17

repo sync

Guess you like

Origin blog.csdn.net/u012514113/article/details/133582586