Gitolite如何导入其它Git代码库
Gitolite如何导入其它Git代码库
续上节,我们配置了《Ubuntu Gitolite管理Git Server代码库权限》,在这里测试下Gitolite如何导入其它git代码库,要求:原服务器有sdk.git项目,我们导入到Gitolite并配置权限管理。停止原服务器对sdk.git的操作,将代码库直接打包
1 |
git@Ubuntu: /git $ tar -zcf sdk. tar .gz sdk.git
|
将sdk.tar.gz传到Gitolite服务器,我传到/tmp下面
Gitolite管理服务器上执行
-
先添加同名的项目
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
[gitadmin@apdn1 conf]$ vi gitolite.conf
repo gitolite-admin
RW+ = gitadmin
repo testing
RW+ = @all
repo sdk #sdn名称与要导入的项目名一样
RW+ = gitadmin #授于用户权限
[gitadmin@apdn1 gitolite-admin]$ git add .
[gitadmin@apdn1 gitolite-admin]$ git commit -m "add sdk repo"
[master 1245da2] add a new repo
Committer: sunny <sunny@apdn1.(none)>
Your name and email address were configured automatically based
on your username and hostname . Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author= 'Your Name <you@example.com>'
1 files changed, 3 insertions(+), 1 deletions(-)
[gitadmin@apdn1 gitolite-admin]$ git push
Counting objects: 7, done .
Delta compression using up to 4 threads.
Compressing objects: 100% (3 /3 ), done .
|
Gitolite服务器
2.导入git代码库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
进入到gituser的项目库目录 /home/gituser/repositories
gituser@ubuntu:~ /repositories $ ls
gitolite-admin.git sdk.git testing.git
可以看到我们刚刚建的sdk.git项目已经存在
我们只需要清空里面的文件
gituser@ubuntu:~ /repositories $ rm -rf sdk.git/*
然后将我们刚刚传到 /tmp/sdk . tar .gz解压后拷贝过来
gituser@ubuntu: /tmp $ tar -zxf sdk. tar .gz
gituser@ubuntu: /tmp $ cd sdk.git
gituser@ubuntu: /tmp/sdk .git$ mv * /home/gituser/repositories/sdk .git/
|
3.测试
sdk项目只有gitadmin有权限操作
1 2 3 4 5 6 7 8 9 10 |
[gitadmin@apdn1 tmp]$ git clone gituser@192.168.1.50:sdk
Initialized empty Git repository in /tmp/sdk/ .git/
remote: Counting objects: 34, done .
remote: Compressing objects: 100% (32 /32 ), done .
remote: Total 34 (delta 8), reused 0 (delta 0)
Receiving objects: 100% (34 /34 ), 17.92 KiB, done .
Resolving deltas: 100% (8 /8 ), done .
顺利拉取成功。
其它修改,提交正常。还有就是之前代码库所有的日志记录也存在。
|
好了,以上就是Gitolite如何导入其它git代码库。
gitolite功能不错,其它功能后续再续写了。
Git / Gitolite 的应用学习
使用Gitolite搭建Git服务器
基于Gitolite的Git服务架设
Fedora通过Http Proxy下载Git
在Ubuntu Server上安装Git
服务器端Git仓库的创建(Ubuntu)
Linux下Git简单使用教程(以Android为例)
Git权威指南 PDF高清中文版
本文永久更新链接地址:
评论暂时关闭