I tried to setup Git on my windows machine the last days (maybe weeks) and it was really anoying. There are many tutorials out there for many different setups, but it still was a bit tricky. This will just be another tutorial, but this was working for me …
Step 1
Download and install Git @ git-scm.org (I used Git-1.7.4-preview20110204.exe) you need this for the server and later for the client, too.
I prefer to use the Explorer-Integrated Git-Bash.
Step 2
Download Apache and all you need to configure SSL.
I used the bundle (xampp-win32-1.7.4-VC6.zip) available on apachefriends.org, because it is easy to install and we can jump right into the configuration.
Just unpack the .zip-File to C:\
Step 3
Goto “C:\xampp\htdocs” and right-click on the folder to open the Git-Bash.
git init --bare test.git
cd test.git
git update-server-info
Now we have created an empty server repository.
Step 4
Goto “C:\xampp\apache\conf” and edit the httpd.conf file.
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
Activate the dav modules by uncommenting.
DavLockDB "/xampp/apache/logs/Dav.Lock";
<Directory "C:/xampp/htdocs/test.git">
# Enable WebDAV
Dav On
# Authentication
AuthType Basic
AuthName "test.git"
AuthUserFile "C:/xampp/apache/conf/htuser.git"
AuthGroupFile "C:/xampp/apache/conf/htgroup.git"
# All users from group test can access
Require group test
# Refuse .htaccess-Files
AllowOverride None
# Allow List dir
Options Indexes
# Acces only with SLL
SSLRequireSSL
</Directory>
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
Now the test.git repository is only available for the users in group test.
Step 5
Now you can start your Apache and switch to the client.
To clone the repository just type:
git clone https://user@mydomain.com/test.git/
Be sure that you don’t forget the trailing slash!
Now we will enter the repository, adding a file, commit our changes and upload the new version to our git repository.
# Enter repository
cd test.git
# Create file foo.txt
echo foo > foo.txt
# Add foo.txt ot our local repository
git add foo.txt
# Commit changes
git commit -m "Adding foo.txt"
# Push changes to our remote repository
git push origin master
Done.