Windows builds GitBlit server and initializes Git warehouse

Posted by justinede on Sun, 30 Jan 2022 19:52:41 +0100

1. GitBlit download and configuration

  • GitBlit official website download address: http://gitblit.github.io/gitblit/
  • The latest version currently downloaded is gitblit-1.9.1 zip
  • Unzip the downloaded compressed package to the installation directory without installation
  • Create Git repository Directory: H:\GitRepositories
  • Modify e: \ program files (x86) \ gitblit-1.9.1 \ data \ gitblit The properties file defines the local storage directory of the warehouse:
git.repositories = H:/GitRepositories
  • Modify the Http protocol port number:
server.httpPort = 8089
  • Modify the Http binding server address:
server.httpBindInterface = 192.168.1.108
  • Modify the HTTP binding server address:
server.httpsBindInterface = 192.168.1.108
  • E:\Program Files (x86)\gitblit-1.9.1\data\gitblit. The contents of the properties file are as follows:
## gitblit.properties

#
# GITBLIT.PROPERTIES
#
# Define your custom settings in this file and/or include settings defined in
# other properties files.
#

# Include Gitblit's 'defaults.properties' within your configuration.
#
# NOTE: Gitblit will not automatically reload "included" properties.  Gitblit
# only watches the 'gitblit.properties' file for modifications.
#
# Paths may be relative to the ${baseFolder} or they may be absolute.
#
# COMMA-DELIMITED
# SINCE 1.7.0
include = defaults.properties

#
# Define your overrides or custom settings below
#
git.repositoriesFolder = H:/GitRepositories
server.httpPort = 8089
server.httpBindInterface = 192.168.1.108
server.httpsBindInterface = 192.168.1.108
  • Modify installservice CMD service installation file:
SET ARCH=amd64
SET CD=E:\Program Files (x86)\gitblit-1.9.1
		 --StartParams="" ^
  • installService. The contents of CMD service installation file are as follows:
@REM Install Gitblit as a Windows service.

@REM gitblitw.exe (prunmgr.exe) is a GUI application for monitoring 
@REM and configuring the Gitblit procrun service.
@REM
@REM By default this tool launches the service properties dialog
@REM but it also has some other very useful functionality.
@REM
@REM http://commons.apache.org/daemon/procrun.html

@REM arch = x86, amd64, or ia32
SET ARCH=amd64
SET CD=E:\Program Files (x86)\gitblit-1.9.1

@REM Be careful not to introduce trailing whitespace after the ^ characters.
@REM Use ; or # to separate values in the --StartParams parameter.
"%CD%\%ARCH%\gitblit.exe"  //IS//gitblit ^
		 --DisplayName="gitblit" ^
		 --Description="a pure Java Git solution" ^
		 --Startup=auto ^
		 --LogPath="%CD%\logs" ^
		 --LogLevel=INFO ^
		 --LogPrefix=gitblit ^
		 --StdOutput=auto ^
		 --StdError=auto ^
		 --StartPath="%CD%" ^
		 --StartClass=com.gitblit.GitBlitServer ^
		 --StartMethod=main ^
		 --StartParams="" ^
		 --StartMode=jvm ^
		 --StopPath="%CD%" ^
		 --StopClass=com.gitblit.GitBlitServer ^
		 --StopMethod=main ^
		 --StopParams="--stop;--baseFolder;%CD%\data" ^
		 --StopMode=jvm ^
		 --Classpath="%CD%\gitblit.jar;%CD%\ext\*" ^
		 --Jvm=auto ^
		 --JvmMx=1024
  • Run GitBlit.com as administrator CMD, GitBlit can be started successfully.
  • Run installservice.com as an administrator CMD, gitblit can be started in the service mode. You can view the gitblit service in the service management console and set it to automatic start, that is, it can run continuously on the server.

2. Git warehouse initialization

  • Browser open URL: http://192.168.1.108:8089
  • Log in to GitBlit web page as admin user (password admin), click "user" to add, edit or delete users, and change user permissions and user passwords.
  • Generate SSH key and enter in the Windows console:
C:\Users\Administrator>ssh-keygen -t rsa -C "i_believe_myself01@163.com"
  • The key type is specified with the - t option. RSA is used here- The C option is used to specify the comment field to facilitate user identification, indicate the purpose of the key or other useful information, where you can enter your own mailbox. After the key generation is completed, it can be found in C: \ users \ administrator Find the generated public key ID in SSH \ directory_ rsa. Pub and private key id_rsa, public key id_rsa. The content in pub is copied to the "user center > SSH keys" of ordinary users. You don't need to enter the password every time you push and pull.
  • Log in to GitBlit website as admin user or ordinary user, click "create version library" and fill in the version library information to create the version library. This paper takes bigdata for GIS platform version library as an example.
  • The following page appears after the library is created successfully:



Open the project source code with the development environment and enter the following commands in Terminal:

git init
git add .
git commit -m "first commit"
git remote add origin ssh://weixiaolei@192.168.1.108:29418/bigdata-for-gis-platform.git
git push -u origin master

You can create an initialization Git warehouse in the local project code and push the local project code to the remote GitBlit server just built.

3. GitBlit version library deletion

  • Enter the version library and click "Edit > Management > delete". This operation does not physically delete the version library.
  • Enter the storage location of the server GitBlit warehouse, i.e. H:\GitRepositories configured above, and delete the version library that you just clicked "delete" below git file, you can physically delete the version library on the GitBlit server.
  • Enter the project source code directory. If the project source code has initialized the GIT warehouse, delete all files and. Git files under the "project source code directory. Git \" directory In the idea folder, open the source code of the project with the development environment, and re initialize git init warehouse.
  • After the GitBlit version library is deleted, restart the GitBlit service.

4. GitBlit startup error

  • Set GitBlit service to start automatically. After a period of time, GitBlit service cannot be started. Right click GitBlit service "start", and the service still cannot be started. Open the latest log file under E:\Program Files (x86)\gitblit-1.9.1\logs \ and record the error message:
2021-06-09 12:38:22 [WARN] FAILED ServerConnector@45c8d09f{SSL-HTTP/1.1}{192.168.1.105:8089}:java.net.BindException: Cannot assign requested address: bind

After investigation, it is found that the server address is changed from 192.168.1.105 to 192.168.1.108, while 192.168.1.105 previously bound in the configuration file is changed to 192.168.1.108, and the service can be started normally.

Topics: jeecgboot