首页 > 其他 > 详细

【ssh简单版git-server 1】git-server权限管理

时间:2016-02-29 02:03:59      阅读:206      评论:0      收藏:0      [点我收藏+]

环境:

    1.类unix系统

    2.git1.6.6+ perl5.8.8+ openssh5.0+  

    3.仓库用户,自加用户git

    4.ssh没有免密钥的用户

    git-server:192.168.50.108

    git-client: 192.168.50.112


部署:

    git-server:       

        1.使用git用户的环境操作,或修改git用户的shell切换后部署

            sudo -u git 

            git clone https://github.com/sitaramc/gitolite.git


            mkdir $HOME/bin

            ./gitolite/install -to /home/git/bin/

       

         2.本机或其他机器生成管理密钥(此处用root作为管理员)

            ssh-keygen -t rsa

            cp /root/.ssh/id_rsa.pub /tmp/

            mv /tmp/id_rsa.pub /tmp/admin.pub

            

          3.配置gitolite的管理员信息

              gitolite setup -pk /tmp/admin.pub

             ls

             logout

    

         4.管理员使用工具git-server(统一工具管理,此处环境是在管理员root下操作,如果提示需要密码则操作是错误的。)            

            git clone git@192.168.50.108:gitolite-admin

        

         5.创建库和添加用户,此处配置类似于svn

            cd gitolite-admin/ && ls (conf和keydir两个目录)

            注:conf记录用户的权限,keydir存放用户的pub公钥

             添加test用户RW+权限

            

                repo gitolite-admin

                    RW+     =   admin

                    RW+     =   test

         

            6.本机或其他机器做ssh公钥,此处选择本机test用户,也可以是其他主机的test用户

            [test@localhost ~]$ ssh-keygen 

            [test@localhost ~]$ scp .ssh/id_rsa.pub root@192.168.50.108:/tmp

    

             7.保存test用户pub密钥

            mv /tmp/id_rsa.pub keydir/test.pub

            cat /home/git/.ssh/authorized_keys

                

           

           8.修改后添加并push到远程

                git add conf

            git add keydir

            git commit -m ‘added foo,bob ‘

            git push

   

注:如要在其他电脑上管理server按如下操作,如果需要帮助可以ssh git@192.168.50.108 help

    

    git-client:

          1.参照git-server第二步生成ssh密钥

          2.参照git-server第三步添加管理员信息,再测

          3.参照git-server第四步和第五步,第七,第八步配置信息        

   

参考文档:https://github.com/sitaramc/gitolite

本文出自 “菜鸟成长记” 博客,请务必保留此出处http://startlinux.blog.51cto.com/10045010/1745853

【ssh简单版git-server 1】git-server权限管理

原文:http://startlinux.blog.51cto.com/10045010/1745853

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!