[TOC]

Build git-server service on Windows system

Use git for Window and CopSSH

Windows 10 and Windows 2008 Server R2 have been tested

Install Git for Window

  1. Open the Git installation software

    The 2017-10-21 _111715

  2. Select the installation path, I will select the default installation path

    The 2017-10-21 _112900

  3. All the way down next until the software is installed

Step 2: Install CopSSH

  1. Open the CopSSH installation software

    The 2017-10-21 _113003

  2. Select the installation path, I will select the default installation path

    The 2017-10-21 _113019

  3. Set up a user and password that you want to connect to over SSH, and change it to one that you can remember

    The 2017-10-21 _113220

    The 2017-10-21 _115427

    On the Window Server, the user password must meet the required password format; otherwise, the user will not be added

    The 2017-10-21 _114424

  4. During the installation process, click ok, you will find that there are two more copssh users

    The 2017-10-21 _113304

    The 2017-10-21 _115927

Step 3: Configure the CopSSH configuration

  1. Open the COPSSH Control Panel

    The 2017-10-21 _115947

    If the service status is red, uninstall CopSSH, delete the users added by CopSSH from the user list in the computer management panel, and perform step 2 again

    The 2017-10-21 _115732

  2. Click on the Add button

    The 2017-10-21 _120243

  3. Select the user to add

    The 2017-10-21 _120557

  4. All the way forward, finally apply, and register the system users with the SSH service

Step 4: Test whether the SSH service is normal

Run SSH [email protected] to test whether the local SSH service is normal. If the SSH connection succeeds, the user on the cli is switched to mgit

The 2017-10-21 _121719

Enter the PWD command on the command line to view the current position

The 2017-10-21 _130503

In this case, the root directory of the command line corresponds to the CopSSH installation directory

Step 5: Set up git-server

  1. In step 4, under the PWD output address, run mkdir code && CD code && git init –bare code.git on the command line

  2. Switch to the directory where you want git clone and run the git clone command

    The 2017-10-21 _122017

    The error message is lack of executable command.

    Copy all files in the mingw32\libexec\git-core folder in the git for window installation directory to the bin folder in the CopSSH installation directory. If there are duplicate files, skip them

  3. Execute the above command again

    The 2017-10-21 _143103

Q&A

remote host identification has changed

The 2017-10-21 _121325

The SSH connection location is not in the /home/[user user name] directory

If the user is installed using CopSSH, the connected directory will be under /var. If you create a user manually, the directory will be under /home/[user username] after the connection

The 2017-10-21 _144202

The 2017-10-21 _130503

The 2017-10-21 _130515

fatal: does not appear to be a git repository

Git clone usr @ host: path/to/gitRepository (path/to/gitRepository is relative address after SSH connections to the directory)