By: http://larrycaiyu.com/2012/05/19/gerrit-gitweb-windows.html
Git is now very popular, and Gerrit is the best server in the enterprise. It not only provides strong authentication and permission control, but also provides excellent code review functions.
Gitweb is a default git code browsing module, which is included in the GIT release version.
Let's talk about how gitweb works in Gerrit without using the Apache server. This is particularly useful in lab and demo environments.
For more information about how to install Gerrit, see Jiang Xin's git authority guide or Gerrit official instructions.
Gitweb problems in Windows
Gitweb is actually a CGI script written in Perl, which is generally used in Apache. In Gerrit, it can also be directly converted to HTML display by calling.
However, if you use "Git for Windows" (mingsys) to install the GIT environment, there are two problems:
- It does not have CGI Modules during installation, so gitweb scripts cannot be started correctly.
- On Windows, Gerrit needs to call Windows commands that can be executed,
gitweb.cgi
Cannot be executed directly.
Solution
Knowing the problem makes it easier to solve it.
First download the corresponding CGI Module, http://search.cpan.org /~ Markstos/cgi/, which is CGI
Version 3.59
Expandlib
Libraries are written to the standard install Perl lib directory of git./usr/lib/perl5/site_perl/
$ Tar-ztvf ~ /Downloads/CGI.pm-3.59.tar.gz CGI. pm-3.59/lib # As long as these few can be $ mv cgi. pm-3.59/lib/*/usr/lib/perl5/site_perl
Now rungitweb.cgi
Then you can complete the operation.
$ "/c/Program Files/git/share/gitweb/gitweb.cgi"
The next step is to get a script.gitweb.bat
Setgitweb.cgi
Wrap it up to make it a Windows Command.
$ cat "/c/Program Files/git/share/gitweb/gitweb.bat"@echo off"C:\Program Files\Git\bin\perl" "C:\Program Files\Git\share\gitweb\gitweb.cgi %*
Where%*
The parameter is passed in.
Finally, configure it in Gerrit.
$ git config --file $site_path/etc/gerrit.config gitweb.cgi "/c/Program Files/git/share/gitweb/gitweb.bat"
In this way, you can. Restart the Gerrit script and you will see it.
Related Links
- Git for Windows http://msysgit.github.com/
- Gerrit code review for git http://gerrit-documentation.googlecode.com/svn/Documentation/2.3/index.html