• Git Http Server


    #http://www.wretch.cc/blog/michaeloil/22286355
    #http://blog.longwin.com.tw/2009/05/build-git-env-over-http-2009/
    
    #安装软件
    sudo apt-get install git-core
    sudo apt-get install apache2
    #启用相应模块
    sudo a2enmod dav_fs
    #sudo a2enmod dav
    
    #设置apache2
    sudo htpasswd -c /etc/apache2/dav_git.passwd dav
    >New password: 123
    >Re-type new password: 123
    >Adding password for user dav
    
    sudo vim /etc/apache2/sites-available/git.conf
    <VirtualHost *:80>
        ServerAdmin user@example.com
        DocumentRoot /var/cache/git
        ServerName git.example.com
        ErrorLog /var/log/apache2/git-error.log
        CustomLog /var/log/apache2/git-access.log combined  
        SetEnv GIT_PROJECT_ROOT /var/cache/git/
        SetEnv GIT_HTTP_EXPORT_ALL
        ScriptAliasMatch ^(/.+?\.git.*)$ /usr/lib/git-core/git-http-backend$1
    
        <Location "/test.git/">
            DAV on
            AuthType Basic
            AuthName "Git"
            AuthUserFile /etc/apache2/dav_git.passwd
            Require valid-user
        </Location>
    </VirtualHost>
    
    #删除原来监听80端口的默认文件
    sudo rm /etc/apache2/sites-enabled/000-default
    #启用新的git配置
    sudo ln -s /etc/apache2/sites-available/git.conf /etc/apache2/sites-enabled/git.conf
    #重启
    sudo /etc/init.d/apache2 restart
    
    
    #设置git
    sudo mkdir -p /var/cache/git/test.git
    cd /var/cache/git/test.git
    sudo git --bare init
    sudo git update-server-info
    sudo cp hooks/post-update.sample hooks/post-update
    sudo chown www-data:www-data -R .
    
    
    goodspeed@bogon:/var/cache/git$ sudo mkdir test.git
    goodspeed@bogon:/var/cache/git$ cd test.git/
    goodspeed@bogon:/var/cache/git/test.git$ sudo git --bare init
    Initialized empty Git repository in /var/cache/git/test.git/
    goodspeed@bogon:/var/cache/git/test.git$ sudo chown www-data:www-data -R .
    goodspeed@bogon:/var/cache/git/test.git$ sudo git update-server-info
    goodspeed@bogon:/var/cache/git/test.git$ sudo cp hooks/post-update.sample hooks/post-update
    goodspeed@bogon:/var/cache/git/test.git$ sudo chown www-data:www-data -R .
    goodspeed@bogon:/var/cache/git/test.git$ ll
    
    
    curl --netrc --location http://127.0.0.1/test.git/HEAD
    curl --netrc --location -v http://127.0.0.1/test.git/HEAD
  • 相关阅读:
    C库函数笔记
    曼彻斯特及差分曼彻斯特编码
    VS2008 由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。
    刚子扯谈:酒装狗熊胆
    poj1410
    新游戏《真·方块无双》发布-穿越混世过险境,运筹方块化无双
    hdu4267 A Simple Problem with Integers
    【转载】变量的存储类型
    【转载】硬盘存储原理和内部结构
    【转载】让windows使用linux系统的命令
  • 原文地址:https://www.cnblogs.com/goodspeed/p/2680284.html
Copyright © 2020-2023  润新知