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 [email protected] If the identity used for this commit is wrong, you can fix it with: 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 [email protected]: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功能不错,其它功能后续再续写了。
相关推荐
LynnOhYeah 2020-02-18
ffcsdn 2011-09-09
chaocc0xs 2012-12-29
vagabond 2011-06-11
kenthomsen 2017-03-28
webhwg 2015-08-01
萌新JedLee 2012-09-04
lljhi0 2013-02-07
nebulali 2012-08-01
smileZZZZZ 2019-06-20
pursuemylife 2017-07-18
chaocc0xs 2017-07-18
pursuemylife 2017-07-18
CSDNA 2015-02-14
FullStackTester 2014-06-11
ffcsdn 2014-02-21
冯三思 2012-05-22