Git Manual
1. server端安装Git
CentOS release 6.2 (Final)
Linux localhost 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux
vi /etc/selinux/config
SELINUX=disabled
reboot
service iptables stop
chkconfig iptables off
rpm -Uvh mod_wsgi-3.3-7.1.x86_64.rpm
rpm -e git-1.7.1-2.el6_0.1.x86_64 perl-Git-1.7.1-2.el6_0.1.noarch
tar zxvf git-1.7.12.4.tar.gz
cd git-1.7.12.4
make clean
./configure --prefix=/usr
make;make install
git --version
2. 安装git-http-backend
略
3. 安装gitolite
cd
mkdir /var/www/gitolite-home
export GITOLITE_HTTP_HOME
GITOLITE_HTTP_HOME=/var/www/gitolite-home
PATH=$GITOLITE_HTTP_HOME/bin:$PATH
tar zxvf gitolite-2.3.1.tar.gz
cd gitolite-2.3.1/
GHH=$GITOLITE_HTTP_HOME
mkdir -p $GHH/bin $GHH/share/gitolite/conf $GHH/share/gitolite/hooks
src/gl-system-install $GHH/bin $GHH/share/gitolite/conf $GHH/share/gitolite/hooks
vi /var/www/gitolite-home/share/gitolite/conf/example.gitolite.rc
在文件开头增加
$ENV{GIT_HTTP_BACKEND} = “/usr/libexec/git-core/git-http-backend”;
$ENV{PATH} = “$ENV{GITOLITE_HTTP_HOME}/bin:$ENV{PATH}”;
gl-setup sitaram
chown -R apache.apache $GITOLITE_HTTP_HOME
vi /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
vi /etc/httpd/conf.d/gitolite.conf
<VirtualHost *:80>
ServerName scm12.test.cn
SetEnv GIT_PROJECT_ROOT /var/www/gitolite-home/repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /var/www/gitolite-home/bin/gl-auth-command/
SetEnv GITOLITE_HTTP_HOME /var/www/gitolite-home
<Location /git>
AuthType Basic
AuthName “Private Git Access”
Require valid-user
AuthUserFile /data/git.conf/passwd
#AuthGroupFile /data/git.conf/group
</Location>
</VirtualHost>
mkdir -p /data/git.conf
touch /data/git.conf/passwd
htpasswd -b /data/git.conf/passwd sitaram 11111
htpasswd -b /data/git.conf/passwd test 11111
htpasswd -b /data/git.conf/passwd wangjian 11111
mv /var/www/gitolite-home/repositories/ /data/git/
ln -s /data/git/ /var/www/gitolite-home/repositories
service httpd configtest
service httpd start
cd /data
git clone http://sitaram:11111@127.0.0.1/git/gitolite-admin.git
cd gitolite-admin
vi conf/gitolite.conf
repo gitolite-admin
RW+ = sitaram wangjian
…
git commit -a -m "add admin"
git push
http://172.16.10.72/git/4. 测试
cd
git clone http://test:11111@127.0.0.1/git/testing.git
cd testing
touch readme
git add readme
git commit -m “first commit”
git push origin master
5. 建新库
cd /data/git/
cp -a testing.git test2.git
cd /data/gitolite-admin/
vi conf/gitolite.conf
…
repo test2
RW+ = @all
git commit -a -m “add new repo”
git push
6. client端安装Git
linux
同上
windows
安装Git-1.8.3-preview20130601.exe
默认安装
安装TortoiseGit-1.8.3.0-32bit.msi
安装步骤到下图时选择”OpenSSH,Git default SSH Client”即可。其它步骤默认就行!
http://www.ossxp.com/doc/git/gitolite.htmlhttp://blog.csdn.net/gracioushe/archive/2010/09/29/5915352.aspxhttp://roclinux.cn/?p=184http://surpass-li.iteye.com/blog/1052311https://github.com/sitaramc/gitolite/blob/pu/doc/http-backend.mkdhttp://www.kernel.org/pub/software/scm/git/docs/git-http-backend.htmlhttp://kasunh.wordpress.com/2011/01/15/git-over-https/http://serverfault.com/questions/205207/ubuntu-git-git-http-backend-and-apachehttp://www.tsingfeng.com/?p=656http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/#apachehttphttp://mattiasgeniar.be/2011/03/04/centos-git-http-push-unavailable-git-not-compiled-with-use_curl_multi/http://fallenlord.blogbus.com/logs/71511589.htmlhttp://gitstory.wordpress.com/7. 安装ldap
vi /etc/httpd/conf.d/gitolite.conf
<VirtualHost *:80>
ServerName scm12.test.cn
SetEnv GIT_PROJECT_ROOT /var/www/gitolite-home/repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /var/www/gitolite-home/bin/gl-auth-command/
SetEnv GITOLITE_HTTP_HOME /var/www/gitolite-home
<Location /git>
AuthType Basic
AuthName “Private Git Access”
Require valid-user
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthLDAPBindDN “cn=Manager,dc=example,dc=com”
AuthLDAPBindPassword “mmjjjj”
AuthLDAPUrl “ldap://172.16.10.181:30251/ou=People,dc=example,dc=com?uid?sub?(objectClass=*)”
#AuthUserFile /data/git.conf/passwd
#AuthGroupFile /data/git.conf/group
</Location>
</VirtualHost>
service httpd restart
http://linuxadminzone.com/how-to-setup-git-http-authentication-using-ldap-in-apache/8. 安装gitweb
由于gitolite不能基于路径/分支控制gitweb浏览的权限,对于要求严格权限的情况,就不要用gitweb了。
cd
cd git-1.7.12.4
make gitwebdir=/var/www/cgi-bin/gitweb install-gitweb
vi /var/www/cgi-bin/gitweb/gitweb_config.perl
$projectroot = "/var/www/gitolite-home/repositories";
vi /etc/httpd/conf.d/gitolite.conf
<VirtualHost *:80>
ServerName scm12.test.cn
SetEnv GIT_PROJECT_ROOT /var/www/gitolite-home/repositories
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GITOLITE_HTTP_HOME /var/www/gitolite-home
ScriptAlias /git/ /var/www/gitolite-home/bin/gl-auth-command/
Alias /gitweb /var/www/cgi-bin/gitweb/
<Directory "/var/www/cgi-bin/gitweb">
AddHandler cgi-script .cgi
DirectoryIndex gitweb.cgi
Options FollowSymlinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Location />
AuthType Basic
AuthName "Private Gitweb Access"
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthLDAPBindDN "cn=Manager,dc=example,dc=com"
AuthLDAPBindPassword "mmjjjj"
AuthLDAPUrl "ldap://172.16.10.181:30251/ou=People,dc=example,dc=com?uid?sub?(objectClass=*)"
Require valid-user
#AuthUserFile /data/git.conf/passwd
</Location>
</VirtualHost>
service httpd restart
http://172.16.10.72/gitweb/http://www.techsiteanalytics.com/index.php/2012/09/05/3477http://blog.csdn.net/renyan20053295/article/details/7188312http://gitolite.com/gitolite/g2/ggshb.htmlhttps://github.com/git/git/blob/v1.7.6/Documentation/git-http-backend.txthttps://github.com/git/git/blob/v1.7.6/gitweb/READMEhttps://github.com/sitaramc/gitolite/blob/v2.0.1/doc/http-backend.mkdhttp://swarm.cs.pub.ro/~razvan/blog/gitweb-access-to-git-repositories/http://swarm.cs.pub.ro/~razvan/blog/http-repository-sharing-asides-gitweb/http://sethrobertson.github.io/HowToPutGitOnTheWeb/GitOnTheWeb.htmlhttps://gist.github.com/karmi/484199http://mesouug.ru/index.php/GIThttps://gist.github.com/iphoting?page=3https://gist.github.com/iphoting/31026349. gitmanager
http://www.oschina.net/p/git+manager/similar_projects?lang=0&sort=time&p=13http://labs.softjourn.com/projects/gitmanager