Android远程服务创建步骤,Android repo/git server 建立过程

1、安装git dameon

view plaincopy to clipboardprint?

$ sudo apt-get install git-daemon-run

$ sudo apt-get install git-daemon-run

2、设置仓库目录

修改/etc/sv/git-daemon/run,配置git tree的目录以及共享目录

view plaincopy to clipboardprint?

$ vi etc/sv/git-daemon/run

#!/bin/sh

exec 2>&1

echo 'git-daemon starting.'

exec chpst -ugitdaemon \

/usr/lib/git-core/git-daemon --export-all --base-path=/pub/gittrees /pub/gittrees

$ vi etc/sv/git-daemon/run

#!/bin/sh

exec 2>&1

echo 'git-daemon starting.'

exec chpst -ugitdaemon \

/usr/lib/git-core/git-daemon --export-all --base-path=/pub/gittrees /pub/gittrees

? --export-all:导出(共享)所有目录,否则要在每个要导出的目录下作如下操作:

view plaincopy to clipboardprint?

$ touch git-daemon-export-ok

$ touch git-daemon-export-ok

? --base-path: 映射仓库地址。/pub/gittrees是镜像目录。比如:

git://your_server_ip/ repository/platform/manifest.git,则仓库地址在

/pub/gittrees/ repository/platform/manifest.git

3、制作android服务器镜像

view plaincopy to clipboardprint?

$ mkdir  /pub/gittrees/android-mirror/

$ chown git.git  /pub/gittrees/android-mirror/

$ cd  /pub/gittrees/android-mirror/

$ repo init -u git://android.git.kernel.org/platform/manifest.git --mirror

$ repo sync

$ mkdir  /pub/gittrees/android-mirror/

$ chown git.git  /pub/gittrees/android-mirror/

$ cd  /pub/gittrees/android-mirror/

$ repo init -u git://android.git.kernel.org/platform/manifest.git --mirror

$ repo sync

这会花很长时间,为将来使用方便,需要耐心等待。

4、建立自己软件团队的公用版本库

1、建立版本库

view plaincopy to clipboardprint?

$ mkdir  /pub/gittrees/our-repository

$ cd  /pub/gittrees/our-repository

$ repo init -u git://your-server-ip/android-mirror/platform/manifest.git --mirror

$ mkdir  /pub/gittrees/our-repository

$ cd  /pub/gittrees/our-repository

$ repo init -u git://your-server-ip/android-mirror/platform/manifest.git --mirror

修改.repo/manifest.xml

view plaincopy to clipboardprint?

-           fetch="git://android.git.kernel.org/"

+           fetch="git://your-server-ip/android-mirror/"

$ repo sync

-           fetch="git://android.git.kernel.org/"

+           fetch="git://your-server-ip/android-mirror/"

$ repo sync

2、创建团队的master-2.1_r2开发分支

1、下载android-2.1_r2代码

view plaincopy to clipboardprint?

$ mkdir my-android-code

$ cd my-android-code

$ repo init -u git://your-server-ip/our-repository/platform/manifest.git –b android-2.1_r2

$ mkdir my-android-code

$ cd my-android-code

$ repo init -u git://your-server-ip/our-repository/platform/manifest.git –b android-2.1_r2

按提示输入自己的用户名和邮箱即可

修改.repo/manifest.xml

view plaincopy to clipboardprint?

-           fetch="git://android.git.kernel.org/"

+           fetch="git://your-server-ip/our-repository/"

$ repo sync

-           fetch="git://android.git.kernel.org/"

+           fetch="git://your-server-ip/our-repository/"

$ repo sync

等10分钟左右,代码下载完成。

2、下载完成后建立主干开发分支

view plaincopy to clipboardprint?

$ repo start master-2.1_r2 --all

$ repo start master-2.1_r2 --all

3、设置远程仓库的别名为my-korg

view plaincopy to clipboardprint?

$repo forall -c 'git remote add mykorg /pub/gittrees/our-repository/\

$REPO_PROJECT.git

$repo forall -c 'git remote add mykorg /pub/gittrees/our-repository/\

$REPO_PROJECT.git

注:删除myorg:

$ repo forall -c git remote rm myorg

4、将分支提交至公共版本仓库

view plaincopy to clipboardprint?

$ repo forall -c git push myorg master-2.1_r2:refs/heads/master-2.1_r2

$ repo sync

$ repo forall -c git push myorg master-2.1_r2:refs/heads/master-2.1_r2

$ repo sync

5、为你的公共版本库建立manifest分支

view plaincopy to clipboardprint?

$ cd my-android-code/.repo/manifests

$ git checkout -b master-2.1_r2

$ vi default.xml

$ cd my-android-code/.repo/manifests

$ git checkout -b master-2.1_r2

$ vi default.xml

按如下方式修改

view plaincopy to clipboardprint?

-           fetch="git://android.git.kernel.org/"

+           fetch="git://172.20.158.5/our-repository/"            review="review.source.android.com" />

-  +  remote="korg" />

-           fetch="git://android.git.kernel.org/"

+           fetch="git://172.20.158.5/our-repository/"            review="review.source.android.com" />

-  +  remote="korg" />

修改完成后提交并将branch提交至公共版本库

view plaincopy to clipboardprint?

$git commit -a

$git remote add our-repository /pub/gittrees/your-repository/platform/manifest.git

$git push your-repository master-2.1_r2:refs/heads/master-2.1_r2

$git commit -a

$git remote add our-repository /pub/gittrees/your-repository/platform/manifest.git

$git push your-repository master-2.1_r2:refs/heads/master-2.1_r2

现在我们自己团队的公共版本库创建完成。

公共版本库的路径为:

/pub/gittrees/our-repository /

外部可访问仓库地址为:

git://your-server-ip/your-repository/platform/manifest.git

Repo访问方法:

view plaincopy to clipboardprint?

$repo init -u git://your-server-ip/our-repository/platform/manifest.git –b master-2.1_r2

$repo init -u git://your-server-ip/our-repository/platform/manifest.git –b master-2.1_r2

Android Miscellaneous

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值