10 月 242014
 

安装:yum -y install mod_ssl  httpd mod_dav mod_dav_fs

git :

yum -y install gettext-devel expat-devel curl-devel zlib-devel openssl-devel gcc perl-devel

cd /usr/local/src
wget https://www.kernel.org/pub/software/scm/git/git-1.8.2.3.tar.gz
tar xzvf git-1.8.2.3.tar.gz
cd git-1.8.2.3
make prefix=/usr/local all
make prefix=/usr/local install

配置

[root@localhost git]# cat /etc/httpd/conf.d/git.conf
SetEnv GIT_PROJECT_ROOT /var/www/html/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git /usr/local/libexec/git-core/git-http-backend
<LocationMatch “^/git/test.git/.*$”>
        Dav On
        Options +Indexes +FollowSymLinks
        AuthType Basic
        AuthName “Git Access”
        AuthType Basic
        AuthName “Please login”
        AuthBasicProvider ldap
        AuthLDAPURL “ldap://192.168.7.1:389/ou=system-admin,ou=login,dc=test,dc=com”
        AuthLDAPBindDN “cn=admin,dc=test,dc=com”
        AuthLDAPBindPassword “test”
        Require valid-user
</LocationMatch>

遇到的问题:

遇到一个奇怪的问题,搭建好git之后,很奇怪的问题。linux下提交无问题,但是windows 提交的时候一直报

git.exe push –progress  “origin” master:master

git: ‘http-push’ is not a git command. See ‘git –help’.
fatal: git-http-push failed

image

后来从一篇文章发现:

新增一config档,并编辑它/etc/httpd/conf.d/git.conf ,让Apache知道GIT的Repository ROOT在哪? 哪个URI会要调用git-http-backend?

配置添加

SetEnv GIT_PROJECT_ROOT /opt/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/

提交的时候就没有问题了。

而且 如果没有配置以上内容。需要执行git update-server-info  否则,clone会报错,

[Fri Oct 24 17:59:05 2014] [error] [client 192.168.0.151] File does not exist: /var/www/html/git/test.git/info/refs

但是如果配置以上内容的话,则无需配置也能clone。

参考:

http://translate.google.com.hk/translate?hl=zh-CN&sl=zh-TW&u=http://blog.xuite.net/zack_pan/blog/65273998-GIT%2Bover%2BHTTP%2B%28GIT%2BHTTP%2BTransparent%29&prev=/search%3Fq%3Dfatal:%2Bgit-http-push%2Bfailed%26newwindow%3D1%26safe%3Dstrict%26sa%3DN%26biw%3D1319%26bih%3D749

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny