Use gitbcontroland vs gitsourcecontrolprovider to build a git work platform based on HTTP (s)

Source: Internet
Author: User
Tags openssl rsa server website git client git commands visual studio git
Document directory
  • 2.1 Introduction
  • 2.2 provide HTTP Services
  • 2.3 provide HTTPS service
  • 2.1 view the certificate package sent to you by the Administrator
  • 2.2 install the. p12 Certificate
  • 2.3 configure the PEM Certificate
  • 5.1 clone Repository
  • 5.2 commit (to local database)
  • 5.3 push (to server database)
Use gitbcontroland vs gitsourcecontrolprovider to build a git work platform based on HTTP (s)

Note:

This solution can be used to build a git Server Based on HTTP (s) and integrate the client with Visual Studio. It is a practical enterprise git deployment architecture.

I have tried several sets of git solutions on the Windows platform. This solution is the simplest and can be easily controlled with security permissions. I hope it will be useful to you ~

Architecture:

Server: msysgit + gitbit

Client: msysgit + tortoisegit + Visual Studio git source control provider

Features:

Communication between the server and client over HTTPS (without SSH, simple)

The server provides website support for user permission control, tracking, and statistics, which is intuitive.

The server can send a certificate to the user. After installing the certificate, the user can access the GIT resources on the server.

 

Server 1. Install msysgit

Msysgit is a Windows git Environment

: Http://code.google.com/p/msysgit/

Installation:

(1) To avoid path problems, it is recommended that the installation directory have no spaces or Chinese characters (such as c: \ git \).

(2) You can continue the other way by default.

It is best to set the system path:

Path c: \ git \ bin; C: \ git \ libexec \ Git-core; % PATH %

 

2. Introduction to gitblit2.1 Installation

Gitblit is a git server website written in Java (similar to GitHub). It provides the GIT service in HTTP/https mode for user permission control, tracking, and statistics, intuitive, simple, powerful, and easy to use.

Http://gitblit.com/

Decompress the downloaded package to a directory (for example, D: \ gitblit \)

2.2 provide HTTP Services

(1) Ensure that the Java SDK is installed first.

(2) Run gitbloud. CMD to create a git website.

(3) If the port conflict cannot run, open the data \ gitbloud. properties file and modify the port parameters, for example:

Server. httpport = 8080 # HTTP service port

Server. httpbindinterface = localhost # address bound to HTTP (domain name or IP address)

(4) You can open the browser to view: http: // localhost: 8080

Log on for the first time. The Administrator account password is admin. Please change it!

After entering, you can set the code library (respository), user, and team)

The default git repository is created in the data/git/folder.

For more detailed operations, see the documents in the docs/folder.

(5) You can use git commands to perform operations, such:

Git clone http: // admin @ localhost: 8080/git/test. Git

2.3 provide HTTPS service

Gitblit provides HTTPS services and secure access channels on the public network, which can effectively authenticate, prevent theft, and prevent tampering. For detailed steps, see http://gitblit.com/setup.html. The following is a brief description:

(1) modify the/data/gitbits. properties file, as shown in figure

Server. httpport = 0 # if it is set to 0, the HTTP service is disabled.

Server. httpsport = 8443 # Set the HTTPS service port

Server. httpsbindinterface = xxx.com # host address (domain name or IP address) bound to the HTTPS service)

Server. certificatealias = xxx.com # host address (domain name or IP) bound to the https ca certificate)

Server. requireclientcertificates = true # the HTTPS protocol must be used to access the client.

(2) create an https ssl Certificate

Run authority. CMD To Go To The gitblit certificates Authority authorization settings window:

Enter basic CA certificate information

Click the button to bring up the input window for basic information of the CA certificate (this window will also pop up when it is run for the first time. You can enter it once)

Enter the IP address or domain name of the host in site name.

Create a host CA certificate (used to declare the identity of the host)

Click the button to pop up the create host CA certificate window, enter and save.

Create a user's personal certificate (used to declare the identity of the user)

Select a user and click the new certificate button on the right.

View certificates

After completing these two steps, you can view the generated certificate in the/data/certs/directory.

You can directly send the zip package to the team members for installation.

(3) send the certificate to team members by email (optional)

Set email server information:

You can modify the mail template file as needed.

In the previous CA certificate window, select a user and click the button to send an email to the user.

 

(4) Restart gitbloud. cmd.

After the. p12 certificate in the compressed package is installed on the client, you can access the website through HTTPS (ie or chrome): https://www.xxx.com: 8443/

For more detailed client usage instructions, see subsequent chapters.

Client 1. Install msysgit

Msysgit is a Windows git Environment

: Http://code.google.com/p/msysgit/

Installation notes:

(1) To avoid path problems, it is recommended that the installation directory have no spaces or Chinese characters (such as c: \ git \).

(2) You do not need to integrate the resource manager menu, because tortoisegit will be integrated later.

(3) You can continue the other way by default.

It is best to set the system path:

Path c: \ git \ bin; C: \ git \ libexec \ Git-core; % PATH %

2. Install HTTPS ssl client certificate 2.1 view the certificate package sent to you by the Administrator

There are several certificate files in it (assume that the user name is cquota and is saved in the D: \ gitclient \ _ keys \ SSL \ cquota \ directory ):

 

C6. p12 includes the private key and public key and CA certificate (for the browser)

Cworkflow. pem contains the private key and public key and CA certificate (for git clients)

Bytes --------------------------------------------------------------------------------------

Csf-. CER Private Key

CA. Cer server-side Public Key Certificate

Readme.txt Installation Guide

2.2 install the. p12 Certificate

The. p12 certificate is for the browser. Double-click the install. p12 file. By default, you will be prompted to enter the password (ask the administrator ). After the installation is complete, you can use IE and chrome to access the server website. For the installation of Firefox P12, see the installation guide. After the certificate is complete, select Internet> content> certificates and find two certificates:

(1) Trusted Root Certificate Authority: CA certificate of git.xxx.com, used to mark the identity of the website

(2) Personal Certificate: the client uses this certificate to connect to the HTTPS service of git.xxx.com.

After installing the p12 certificate, you can access the GIT server site, such as https://git.xxx.com: 8443/

 

2.3 configure the PEM Certificate

This certificate is used by the GIT client.

OpenSSL RSA-in "D: \ gitclient \ _ keys \ SSL \ cnames. pem"-out "D: \ gitclient \ _ keys \ SSL \ cnames. Key"

Git config -- Global HTTP. sslcert "D: \ gitclient \ _ keys \ SSL \ cjh. pem"

Git config -- Global HTTP. sslkey "D: \ gitclient \ _ keys \ SSL \ cjh. Key"

Git config -- Global HTTP. sslverify false

Git config -- Global -- list

After the. pem certificate is set, you can use git to access the HTTPS git service on the server.

 

3. Install tortoisegit

Http://code.google.com/p/tortoisegit/wiki/Download

All the way to the past by default. After the installation is successful, the resource manager right-click the menu to integrate tortoisegit.

4. Install the Visual Studio git plug-in

Tools-> Extension Manager-> Search and install git source control provider and restart Visual Studio

Tool-> Option-> source control: Select git source control provider

Set tortosegit path in git source control provider c: \ Program Files \ tortoisegit \ bin \ tortoisegitproc.exe

5. Git basic operations 5.1 clone Repository

Right-click the blank area in the D: \ gitclient \ directory and choose "Git clone" from the shortcut menu to clone the database from the server.

Https: // admin@git.xxx.com: 8443/git/test. Git

You can also run the following command:

Git clone https: // admin@git.xxx.com: 8443/git/test. Git D: \ gitclient \ test

Cloning into 'test '...

Remote: counting objects: 11, done

Remote: Finding sources: 100% (11/11)

Remote: Getting sizes: 100% (7/7)

Remote: total 11 (delta 0), reused 11 (delta 0)

Unpacking objects: 100% (11/11), done.

 

5.2 commit (to local database)

Use the right-click menu in Visual Studio to perform the commit operation (if tortoisegit is not installed, you can directly use the GIT bash command line tool)

You must write something during commit. After commit is complete, it can be pushed to the server.

Note: Tips for selecting all files in commit: Use the Shift key to select all files, and then click checkbox.

5.3 push (to server database)

 

 

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.