Gitolite+Gerrit服務器搭建

1、 安裝ubuntu系統

2、 安裝x11vnc遠程管理

3、 安裝openssh服務器端

4、 安裝gitolite

5、 安裝git daemon(可選)

6、 安裝gitweb

7、 安裝java

8、 安裝gerrit

http://blog.csdn.net/maokunlove/article/details/51829408


9、 可能問題

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服務的一個特性。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章