Build a git Server on Windows

Source: Internet
Author: User
Tags visual studio git

Git has more flexibility in versioning than with SVN, and for open source projects, we can be hosted on GitHub, which is very handy, but closed-source projects charge a lot of money.

So what about private projects, how do you use git for code versioning? We can build our own git servers. In general, there are many tutorials on how to build git on Linux, but how do you build a git server under the Windows Server platform?

For many. NET users, the code is written in Visual Studio, the tool is not supported by the SSH protocol, through search and contrast, found that gitblit can easily build services, he was written in Java, all installed on the premise of installing the Java Runtime Environment.

1th step : Download java and install java. I'm downloading the jdk1.7.0_79 here.

2nd Step : Configure Java environment variables

Right-click "Computer" + "Properties" + "Advanced system Settings" + "advanced" + "environment variables" = "System Variables".

    1. NEW: Variable name: java_home; Variable value: C:\Program files\java\jdk1.7.0_79 "Specifically, according to your own installation path, my is installed on the D-Drive"

    2. NEW: Variable name: CLASSPATH; variable value:%java_home%/lib/dt.jar;%java_home%/lib/tools.jar

    3. Add: Locate the path variable and select Edit. Add the%java_home%/bin;%java_home%/jre/bin to the end of the variable value.

3rd Step : Verify that Java is installed successfully.

In the Command window, enter Javac, carriage return, and if the following information appears, the installation is successful.

4th step : Download Gitblit. : http://www.gitblit.com/

5th Step : Unzip the downloaded compressed package, without installation. Path is C:\gitblit-1.8.0

6th Step : Create a folder to store the project code. This is G:\GitProject\webui.

7th Step : Configure Gitblit, file under C:\gitblit-1.8.0\data, open gitblit.properties, there is include = Defaults.properties, description of configuration information in Defaults.properties

2. Locate the Git.repositoriesfolder (database path) and assign the value to G:\GitProject\webui.

3. Locate the Server.httpport, set the port number of the HTTP protocol

4. Locate the Server.httpbindinterface and set the IP address of the server. Set up your server IP here.

5. Locate server.httpsbindinterface, set as localhost

Also pay attention to see Server.shutdownport, its default value is 8081, whether it is occupied, if the occupation please modify.

6. Save and close the file.

8th Step : Run the gitblit.cmd batch file. The running result is as follows and the operation succeeds.

In the browser input: http://192.168.180.159:10010/, by default, you can login with admin and admin, and then change the password.

Of course, if you register Gitblit startup in Windows Services in Windows, you can save gitblit.cmd every time you run it.

Set up


SET ARCH=AMD64 (64-bit, 32-bit machine for x86)

Set up


The value of Set CD=C:\GITBLIT-1.8.0,CD is the path of Gitblit, the startup parameter is set to NULL, with the default parameters,--startparams= "" ^

Then, open cmd as an administrator and run the batch file Installservice.cmd.


If the exception is not indicated, the "gitblit" service can be found in the "services" component.

Enter in the browser: http://192.168.180.159:10010/, you can create teams and users, and configure permissions after you log on as an administrator

You can then create a WebUI repository and click the Git drop-down list to view network addresses such as Ssh,http:

Since Visual Studio git does not support SSH, open the VS2015 Team Explorer with the HTTP protocol

Click the [Clone] button, and then click [New] under Solution

Create a Web site, such as:

Switch to Solution Explorer and you can see the project file structure:

We can add and edit this project file:

You need to submit the project to the server below

At this point, you can refresh http://192.168.180.159:10010/tree/webui.git to view the server directory structure:

Build a git Server on Windows

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.