分享

git

 bananarlily 2014-11-14

Git Manual

1.         server端安装Git

CentOS release 6.2 (Final)

Linux localhost 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 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”即可。其它步骤默认就行!

clip_image001

 

http://www./doc/git/gitolite.html

http://blog.csdn.net/gracioushe/archive/2010/09/29/5915352.aspx

http:///?p=184

http://surpass-li./blog/1052311

https://github.com/sitaramc/gitolite/blob/pu/doc/http-backend.mkd

http://www./pub/software/scm/git/docs/git-http-backend.html

http://kasunh./2011/01/15/git-over-https/

http:///questions/205207/ubuntu-git-git-http-backend-and-apache

http://www./?p=656

http://www./blog/2009/05/06/8-ways-to-share-your-git-repository/#apachehttp

http:///2011/03/04/centos-git-http-push-unavailable-git-not-compiled-with-use_curl_multi/

http://fallenlord./logs/71511589.html

http://gitstory./

 

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:///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./index.php/2012/09/05/3477

http://blog.csdn.net/renyan20053295/article/details/7188312

http:///gitolite/g2/ggshb.html

https://github.com/git/git/blob/v1.7.6/Documentation/git-http-backend.txt

https://github.com/git/git/blob/v1.7.6/gitweb/README

https://github.com/sitaramc/gitolite/blob/v2.0.1/doc/http-backend.mkd

 

http://swarm./~razvan/blog/gitweb-access-to-git-repositories/

http://swarm./~razvan/blog/http-repository-sharing-asides-gitweb/

http://sethrobertson./HowToPutGitOnTheWeb/GitOnTheWeb.html

https://gist.github.com/karmi/484199

 

http:///index.php/GIT

https://gist.github.com/iphoting?page=3

https://gist.github.com/iphoting/3102634

 

9.         gitmanager

http://www.oschina.net/p/git+manager/similar_projects?lang=0&sort=time&p=13

http://labs./projects/gitmanager

 

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多