多仓库代码管理器Repo的安装 使用以及服务器搭建

               

多仓库代码管理器Repo的安装,使用以及服务器搭建

    描述一下感受,使用Git有一年半了。前半年是管理自己的项目,后半年直接就是实战管理公司的项目。不仅仅是使用,也为公司搭建了Gitlab服务器,对Git有了一定了实战经验,也可以解决一些问题。能深深地感受到「使用拷贝解决多人开发的那个阶段」是多么的令人神伤。当时管理的是Android4.2源码,直接从厂商接过来就是一个Git管理了一整套源码,逐渐有新的问题出来了,源码太庞大不好管理,特别是和单个APP之间的管理相当混乱,APP修改一下就要在整个系统源码上做个提交,这一点是相当难以接受的。当时想到了使用Git中的子模块的概念,但是效果并不理想,每每想起那段「岁月」,心里都不太是滋味。还好现在使用上了Repo,这个文章尽量包含的全一些。本文假定的读者已经熟悉Git使用。

1.安装

每个vender可能都提供了各自的安装方法以解决Google不能访问的问题,我这里尽量提供一个通用的安装方法,比较repogit一样属于一个第三方的管理软件。这里参考Android开发者网站的方法installing-repo

To install Repo:

Make sure you have a bin/ directory in your home directory and that it is included in your path:

$ mkdir ~/bin
$ PATH=~/bin:$PATH

Download the Repo tool and ensure that it is executable:

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

: curl那行仅仅是下载一个文件,如果不能正常下载通过Chrome访问下载也是一样的。

    这样就安装成功了:

$ repo help

usage: repo COMMAND [ARGS]

repo is not yet installed.  Use "repo init" to install it here.

The most commonly used repo commands are:

  init      Install repo in the current working directory

  help      Display detailed help on a command

For access to the full online help, install repo ("repo init").

注:这是一个简版的repo,再进行Android源码clone的时候会重新下载一个更全的repo版本。

2.使用

官方教程在这里,将repo中的repo地址改为:https://code.csdn.net/kangear/git-repo.git

中间遇到这个问题:fatal: branch 'stable' has not been signed,最后查实必须要有stable分支和tag信息才能正常进行下面的步骤。

第个仓库的代码修改提交还都是按照Git的使用方法add/commit,以前的status可以使用repo status来查看所有的状态了;diff也可以使用repo diff来查看差异;

在本地管理repo,就相当于一下载添加400Git库。

问题:

1.Please, commit your changes or stash them before you can switch branches.  Aborting  

      Fix:之前不了解是怎么回事就是一个劲地慌,这个其实是Git提示的信息,解决方法就是到每个库中执行一个git reset --hard就好了。参考Switching a branch after aborting current changes in git。起因就是库已经错乱了,可能源于不熟悉repo,乱同步了不同的库造成的。

注:1.repo不能乱使用,因为它包含了仓库的各个东西。

    2.

--repo-url 没有什么特殊的东西,都可以github/code.csdn

-u       manifest仓库,包含了整个项目的分支版本等等信息,必要时要指定分支名称才能clone如:-b android-4.4

-m      Clone的具体的版本信息。

完整例子:

~/repo/repo init --mirror --repo-url ssh://[email protected]/repo/rk/tools/repo -u ss

h://[email protected]/repo/rk/platform/manifest -b android-4.4 -m rk3188_android

4.4.1.xml

技巧

1.多核加速 像make一样可以进行多核加速repo sync -j32.

服务器

尝试过使用镜像还做服务器,但是没有成功。暂时也没有多人开发就先不弄了。

           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

猜你喜欢

转载自blog.csdn.net/hfyutdg/article/details/86609329