Git服务器搭建

1、 安装ubuntu系统


2、 安装x11vnc远程管理

3、 安装openssh服务器端

5、 安装git daemon(可选)

6、 安装gitweb

7、 安装java


8、 安装gerrit

8、 问题解决

1. 服务器不接显示器远程vnc连接不上,服务器端错误如下:

The System is running in low-graphics mode
Your screen, graphics card, and input device settings cound not be detected correctly. You will need to configure these yourself.

解决方法如下:

cd /etc/X11
sudo cp xorg.conf.failsafe xorg.conf

reboot重启就好了

2. 开启git外网同步功能:

使用智能HTTP协议查看文件git-http-backend的安装位置,可以用如下命令。Ls $(git –exec-path)/git-http-backend更改Apache的配置文件:sudo vim /etc/apache2/sites-available/default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

加入

        #Git configuration
        SetEnv GIT_PROJECT_ROOT /home/git
        SetEnv GIT_HTTP_EXPORT_ALL
        SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER

        # This pattern matches git operations and passes them to http-backend
        ScriptAliasMatch \
                "(?x)^/git/(.*/(HEAD | \
                        info/refs | \
                        objects/(info/[^/]+ | \
                                [0-9a-f]{2}/[0-9a-f]{38} | \
                                pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
                                git-(upload|receive)-pack))$" \
        /usr/lib/git-core/git-http-backend/$1

        # Anything not matched above goes to displayable gitweb interface
        ScriptAlias /git /usr/share/gitweb/gitweb.cgi/

        # Git repository # Read-Only
        <LocationMatch "^/git/.*/git-receive-pack$">
                #Write access
                AuthType Basic
                AuthName "git repository"
                AuthUserFile /etc/apache2/gitAuth/Authfile
                Require valid-user
        </LocationMatch>
        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

说明: SetEnv GIT_PROJECT_ROOT设置版本库的根目录为/home/git

SetEnv GIT_HTTP_EXPORT_ALL设置所有版本库均可访问,无论在版本库中是否存在git-daemon-export-ok文件。默认只有在版本库目录中存在git-daemon-export-ok文件时,该版本库才可以访问。这个文件是git-daemon服务的一个特性。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值