您的位置:首页 > 移动开发 > Android开发

Git服务器搭建

2016-07-05 10:56 519 查看

1、 安装ubuntu系统

2、 安装x11vnc远程管理

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

3、 安装openssh服务器端

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



4、 安装gitolite

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

5、 安装git daemon(可选)

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

6、 安装gitweb

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

7、 安装java

8、 安装gerrit

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

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服务的一个特性。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Android git 服务器 gerrit