<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-alt:Arial; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:536871559 0 0 0 415 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} pre {margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Courier New"; mso-fareast-font-family:宋体;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} -->
Git Installation Document
<First Edition>
Xoi
2009-06-16
Set Machine
OS Centos5.2
HD Ext3
Free Space 1G for software
Port 80
Application software installs path: /usr/local
Repository data path: /data/source
Application Software version
Apache httpd :2.2.11
Set Git On Web
This is a typical Apache+Git setting which approves accesses via HTTP to Got server.
Also, this process could take you a long time to download everything and make it work. Just be patient.
Preparation:
GCC is a tool to compile Linux c/c++ program.
Please make sure that GCC was installed on your Linux. To do that, you could just use yum install:
#yum install gcc
Step 1: Apache
If you have done that, you can try to uninstall it with
#yum remove httpd
Or
#rpm –e httpd
Here is the address to download the latest source of Apache. What I’ve tried is httpd-2.2.11. After you have downloaded the .gz file, do the following:
a) Installation Apache and install webdav module
#tar –zxvf httpd-2.2.11.tar.gz
#cd /httpd-2.2.11
#./configure –enable-module=so –enable-dav –enable-dav-fs –enable-so –prefix=/usr/local/apache2
#make
#make install
#make clean
b) Copy the httpd file to init.d folder.
#cp
/usr/local/apache2/bin/apachectl
/etc/init.d/httpd
Then, open your Web browser and input http://localhost into the address blank, if you could see “It workds!”, that means your Apache service has been started successfully.
c) Open the webdav module. Change the httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
Add
DavLockDB "/usr/local/apache2/var/DavLock"
#mkdir –p /usr/local/apache2/var
d) Start Apache service and check the result.
#/etc/init.d/httpd stop
(or : service httpd stop)
#/etc/init.d/httpd start (or : service httpd start)cd ls
Step 2: Setup up Git repository on server
a).chang the httpd.conf file and add below list under file
<Directory /data/source>
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /usr/local/apache2/auth.git
Require valid-user
Options None
Order allow,deny
Allow from all
</Directory>
b).create new apache user to access git and set the password
htpasswd –c /usr/local/apache2/auth.git gituser
b).change the /data/source rights
chown –R apache.apache /data/soruce
d).add a test project on server.
#cd /data/source/
#mkdir helloword
#cd helloword
#git init
#git update-server-info
Note. Some version need to do this
#mv hooks/post-update.sample hooks/post-update;
#chmod +x hooks/post-update;
#git update-server-info
Step 3: Uses git on client
a).if you client is Linux then go to uses home folder create access file
#cat << EOF >> ~/.netrc
#machine servername/serverIP
#login gituser
#password gituser’s password
#EOF
If you Os is windows .then you need to install a Cygwin-x tool.
b). clone the project and update into server
#cat << EOF >> ~/.netrc
#cd /tmp
#git clone http://server/helloword/.git
#cd helloword
#git config remote.upload.url http://<gituser>@<servername>/helloword/.git
#echo "this is a test" > hi.txt
#git add hi.txt
#git commit -m "hi.txt test file added."
#git repack
#git prune
#git pull
#git push upload master
keynotes
1. Please make sure you apace have installed the webdav module
2. Please make sure you apache service have open the webdav. It needs to change the httpd.conf file. Or either you can uses cadaver to verify it
2. Please make user you source folder have add rights to apache user
Chown and chmod.