Git-gitblit-tortoisegit building a Windows git local server

Source: Internet
Author: User
Tags git client

1, gitblit installation1.1, Gitblit introduction

The

Git is well-liked by programmers in the area of version control. For open source projects, can be hosted free of charge to github above, quite convenient. But private project hosting to github will charge quite an expensive fee. Also some enterprises, units developed in the LAN, then how to use git code version control it? We can build our own git server locally. linux on the building git server is quite convenient, online information is also many, specifically can refer to Liao Xuefeng official website-git Tutorial- install git Be interested in learning and learning. So windows under How to build git server it? By comparison, it is found that gitblit can be conveniently built lang= >win "en-US" git platform. gitblit is an open source git server java implementation, so the premise of use is to install java run-time environment.

1.2. Installation Environment 

  software:jdk 1.8.0_65, Gitblit1.8.0

  operating system:win 10 Home Edition

1.3. Installation Steps

The first step: download Java and install Java, I use the JDK 1.8.0_65.

Step Two: Configure the Java environment variables.

Right-click Computer, select Properties > Advanced > System Settings > Advanced > Environment Variables > System variables.

1, New: variable name:java_home; Variable value:C:\Program files\java\jdk1.8.0_65 (depending on your own installation path, mine is installed on the C Drive)

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

3, add: Find the PATH variable, select Edit. Add the%java_home%/bin;%java_home%/jre/bin to the end of the variable value .

Step Three: Verify that Java is installed successfully.

To open a command-line window, enter the directive:

  CTRL + R

  Cmd

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

    

Fourth step: Download and install gitblit,http://www.gitblit.com/

    

Click Direct Download, after the download is complete, directly decompression can, without installation, my decompression path is:C:\jstao\soft\itPackage\gitblit-1.8.0

  

Fifth Step: Configure Gitblit.

1. First create a folder to store the project code. The folder I created here is C:\jstao\workspace\gitblitWorkspace

2. Enter the extracted directory and enter the Data folder. Open the Defaults.properties file.

3, positioning to Git.repositoriesfolder, assignment value is C:\jstao\workspace\gitblitWorkspace

  

4, continue to locate to Server.httpport, configure the HTTP protocol port number, the default 0 identity disable HTTP protocol, here is assigned to 10010

  

5. Navigate to Server.httpbindinterface, configure the IP address of the server

  

6, positioning to Server.httpsbindinterface, assigned to localhost

  

7, save, close the file.

8. Switch to unzip directory and double click to run gitblit.cmd batch file. Run successfully,:

  

  9. After the service runs successfully, test the following. Enter the IP address in the browser :http://127.0.0.1:10010/, the default user name and password are admin, login can be modified, suggested changes. The normal access instructions have been successfully deployed .

  

  

10, every start git service to double-click the following gitblit.cmd batch file, is not very annoying, there is no boot automatically start the operation of the service? Of course! Take a look at the configuration steps.

11, switch to the decompression directory, open the Installservice.cmd file for configuration. Find Arch Assignment AMD64 (64-bit os,32 bit is X86)

12, under the Arch line, add a new row, the CD assignment path is the decompression path ( Note that there is no space behind the CD ):

  SET cd=c:\jstao\soft\itpackage\gitblit-1.8.0

13. Set the startup parameter to a null value, i.e. --startparams= "" ^

  

  

finally , select the installservice.cmd batch file and open it as an administrator.

Without prompting for an exception, the "Gitblit" service can be found in the Windows Services component. Then set the service startup type to "Automatic", and the service will start automatically in the future.

  

1.4. Create a version library

The first step: to open the browser into the IP address, the initial user name admin, password admin login gitblit (password can be modified, suggested changes)

Step Two: Click Create Repository.

  

Step three: Enter a name, description. Other values are good by default and can be changed according to project requirements.

  

Fourth step: Successfully create an empty version of the library, see some official tips. Users can push content to the warehouse as prompted.

  

  Fifth Step, Create user

In general, it is not recommended to use the Admin Account admin for push, the general operation is to push the content to the warehouse on the client side (clients). Admin Account Admin is only responsible for managing the server site and does not involve actual business content. This includes creating a repository operation, which you can then authorize the user to execute. Create a new user action below.

5.1,Admin login, click the user in the drop-down menu

  

5.2. Click "Add User" in the top right corner to go to the Add User page.

  

General completion, the Properties tab can be completed according to the actual situation, optional.

5.3. Complete the Access Rights page and configure the repository permissions.

5.3.1, select Repository, select logit.git

5.3.2, give specific permissions,R (clone ) generally give test candidates,RW (push ),RWC (push, create ref),RWD (push, create delete ref),rw+ Generally given to developers, when selected, press the Add button

5.3.3, finally, choose Save, create success

5.3.4, here I created three users,Libai for testers,Dufu,Baijuyi for developers

  

  

2, client Git installation 2.1, self-download installationgit client

Git:https://git-for-windows.github.io/

2.2. Configurationgit client

  git local User Configuration, anywhere, right-click on the GIT bash terminal and enter the command line to configure Git

$ git config--global user.name "Jstao"

$ git config--global user.email "******@163.com"

Demo, push a new file from the local to the warehouse.

  $ mkdir logitproject Create a new folder Logitproject

$ cd logitproject/   go to this folder

$ touch Readme.md   Create a new file

  

  $ git init

$ git Add readme.md

$ git commit-m "logit Project first commit."

$ git Remote add Origin ssh://[email Protected]:29418/logit.git

$ Git push-u Origin master (you will need to enter the password here, return)

  

Display, the local push to the warehouse is successful.

Next, you can verify the following on the web side. , refresh your browser to see

  

You can see that you have committed to the remote repository.

2.3. Password-free cloning (push) operation

You can see that you need to enter a password when you push, and each time you push it. Is there an operation that can make frequent pushes without requiring a password? Of course there is, look at how to operate, the main operation is the client command line to create SSH key, through the following command:

  $ ssh-keygen-t rsa-c "[Email protected]"

  Then to the user's home directory to find the . SSH folder, the following generated the Id_rsa and id_rsa.pub two files, the content of the pub file copied, uploaded to the gitblit site's own account User Center ->ssh, add success, then the operation through the ssh://protocol later, you can not use the password.

  

2.4. using Git in idea

Open Idea file->setting (or use fast add ctrl+alt+s)

Configure Git.exe to idea

  

Configuration is complete, test to see. Click Test

  

Show the test is successful, you can start pulling the project

  

Then you can pull the project locally and you can develop it properly.

3.TortoisegitInstallation use

The above is enough, but, in general, we installed a git client tortoisegit, more convenient for our development.

3.1, Installation Tortoisegit

  installation Tortoisegit-2.6.0.0-64bit.msi

  installation tortoisegit-languagepack-2.6.0.0-64bit-zh_cn.ms

Tortoisegit and Language pack:http://tortoisegit.org/download/

  Note:tortoisegit is a plugin for git, and thegit program itself is still installed, and we've already loaded it.

3.2. Using Tortoisegit

Right-click a git clone to clone the remote repository project locally.

After development is complete, it can be submitted to the remote repository.

Git-gitblit-tortoisegit building a Windows git local server

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.