基于github创建manifest来管理项目

前言

为了理解repo的概念和熟悉掌握repo常见操作,本文基于github来给大家展示如何创建仓库,如何使用repo来管理多个仓库. 同时也能为大家展示如何在线管理自己的代码。


一、Repo是什么?

Repo是Google方便管理Android 多仓库开发的管理工具。 Repo 简化了跨多个代码库运行的流程,与 Git 相辅相成。 详情可以参考Google官方网站

二、Repo 安装(ubuntu)

1. 方式一

sudo apt-get update

sudo apt-get install repo

2.方式二

mkdir ~/bin

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

3. 配置访问Git库的参数

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

三、创建manifest

1. 登录github网站

 GitHub: Let’s build from here · GitHub, 创建manifest仓库.

 2. 配置连接github的对应的key

 3. 上传manifest.xml

同步代码

git clone git@github.com:account_name/manifest.git

manifest.xml(示例):

?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote name="origin" fetch="https://github.com/<account_name>/" review="https://github.com/<account_name>" />
  <default revision="master" remote="origin" sync-j="4" />
  <project path="source/security" name="security" />
  <project path="source/safety" name="safety" />
  <project path="source/slt" name="slt" />
</manifest>

然后上传manifest.xml.

manifest具体标签含义 可参考Link

四、管理代码

1. 创建projects目录,然后运行

repo init -u git@github.com:account_name/manifest.git -b master --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/

2. repo sync  (首次sync可能需要输入github账号和密码)

3. repo start master --all

这样就能下载整个项目的代码了。


总结

参考文档

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值