zoukankan      html  css  js  c++  java
  • 搭建Git Public Repository时的一些注意事项

    访问Git时使用Git协议是最高效的,虽然也存在一些缺陷,主要是没有访问权限的控制,但在可信环境下对速度和效率有较高要求时直接采用git协议还是可以考虑的
    在采用Git协议搭建Public Repository时需要注意的事项有:
    (1)安装git-daemon,并确保git-daemon所使用的端口(9418)允许accept,这个可以在iptables中配置
    (2)创建一个bare repository,可以通过clone来实现,例如$ git clone --bare ~/proj proj.git
    (3)在repository中创建git-daemon-export-ok文件,以允许git-daemon将该repository纳入管理,执行

      $ touch proj.git/git-daemon-export-ok
    (4)增加访问控制功能,准确地说就是控制read/write
      可以通过$ git config daemon.receivepack true 增加写的权限,否则该repository在使用git协议时只允许读不允许写
      或者在启动git-daemon时显式指定允许receivepack,比如git-daemon --verbose --reuseaddr --base-path=/home/foo --enable=receive-pack

    注意,在搭建使用http/https访问git的系统时相对于使用git协议的来说有一些特殊工作要做:
      repository创建完成之后需要执行
    update-server-info命令,以便于client找到该git repository所在的server所拥有的references and packs,这些references and packs存放于 $GIT_DIR/info and $GIT_OBJECT_DIRECTORY/info目录下
      所以,方便一点儿的做法是:
      (1)创建public repository之后直接执行如下命令
        $ git --bare update-server-info
      (2)更改post-update hook,利用git的hook在repository更新之后自动执行update-server-info
            将hooks目录下的post-update.sample更改为post-update
        为post-update增加执行权限,$ chmod a+x hooks/post-update

    参考资料:
    (1)http://stackoverflow.com/questions/2085402/what-does-git-update-server-info-do
    (2)http://book.git-scm.com/4_setting_up_a_public_repository.html
    (3)http://www.elpauer.org/?p=337



  • 相关阅读:
    (ubuntu ufw)My firewall is blocking network connections from the docker container to outside
    nginx repos
    Xvfb新建虚拟X窗口,通过x11vnc启动VNC Server并转发Xvfb启动的虚拟窗口
    xdotool xdotool模拟击键和鼠标移动--CutyCapt是一个截图工具,xvfb-run
    zabbix debug and vulnerability https://www.zabbix.com/documentation/3.0/manual/concepts/sender
    初探 Nginx 架构
    Nginx缓存
    Nginx代理功能与负载均衡详解
    CentOS 7 部署 nginx-1.14.2
    LDAP第三天 MySQL+LDAP 安装
  • 原文地址:https://www.cnblogs.com/Jerryshome/p/2245282.html
Copyright © 2011-2022 走看看