Integrate gitweb and Gerrit on Windows

Source: Internet
Author: User
Tags install perl
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:

  1. It does not have CGI Modules during installation, so gitweb scripts cannot be started correctly.
  2. On Windows, Gerrit needs to call Windows commands that can be executed,gitweb.cgiCannot 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

ExpandlibLibraries 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.cgiThen you can complete the operation.

$ "/c/Program Files/git/share/gitweb/gitweb.cgi"

The next step is to get a script.gitweb.batSetgitweb.cgiWrap 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.