Benutzer-Werkzeuge

Webseiten-Werkzeuge


git:windows

Git on Windows

To install git for windows go to website: https://git-for-windows.github.io/ and download the latest version. I tested it with Git-2.3.5.8-dev-preview-32-bit.exe.

Apache virtual host configuration:

gitweb.conf
<VirtualHost *:80>
SetEnv GIT_PROJECT_ROOT "D:/Gitrepos"
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAliasMatch \
	"(?x)^/(.*/(HEAD | \
			info/refs | \
			objects/(info/[^/]+ | \
				[0-9a-f]{2}/[0-9a-f]{38} | \
				pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
			git-(upload|receive)-pack))$" \
			"D:/Git/mingw64/libexec/git-core/git-http-backend.exe/$1"
 
DocumentRoot "D:/Git/mingw64/share/gitweb"
<Directory "D:/Git/mingw64/share/gitweb">
	DirectoryIndex gitweb.cgi
	<Files *.cgi>
		SetHandler cgi-script
	</Files>
	Options ExecCGI FollowSymLinks
	SetEnv  GITWEB_CONFIG "d:/Gitrepos/gitweb.conf"
	AuthType Digest
	AuthName "Git Password Required"
	AuthDigestDomain /git/
	AuthUserFile "D:/Gitrepos/htdigest_passwd"
	Require valid-user
</Directory>
<Directory />
	AuthType Digest
	AuthName "Git Password Required"
	AuthDigestDomain /git/
	AuthUserFile "D:/Gitrepos/htdigest_passwd"
	Require valid-user
</Directory>
</VirtualHost>

Edit the file d:\Git\mingw64\share\gitweb\gitweb.cgi and change the first line to:

#!D:/Strawberry/perl/bin/perl.exe

And modify the function get_file_owner:

sub get_file_owner {
	my $path = shift;
 
	my $owner = "Matthias Fechner";
	return to_utf8($owner);
}

Create a config file for gitweb:

d:\gitrepos\gitweb.conf
our $GIT = "d:/Git/bin/git";
our $projectroot= "d:/Gitrepos";
our $git_temp = "/d";
our $projects_list = "d:/Gitrepos/projects.list";
our $export_ok = "git-daemon-export-ok";
our $strict_export = "false";

If you get an error message that CGI.pm is missing you can install it manually using the cpan shell. At first we define a possibly required proxy, so open a git shell and do:

export http_proxy=http://proxyhost:proxyport/
export ftp_proxy=http://proxyhost:proxyport/
cpan install CGI

If you have problems with proxy authentication you can configure user and password also manually with:

cpan
o conf http_proxy proxyhost
o conf ftp_proxy proxyhost
o conf proxy_user username
o conf proxy_passw password
o conf commit
exit
git/windows.txt · Zuletzt geändert: 2015/11/27 13:46 (Externe Bearbeitung)