How to Set Up a Git Server with SSH on Windows

Setting up a git server with SSH on my LAN can be confusing. So many suggestions exist that you may get lost in it. This article will help you install Cygwin. This includes installing Cygwin on your Windows machine. First, install...

Part 1 of 2:

Install and Set Up Cygwin

  1. Picture 1 of How to Set Up a Git Server with SSH on Windows
    First, install Cygwin from its website.
  2. Picture 2 of How to Set Up a Git Server with SSH on Windows
    Then install git and OpenSSH packages, either from the links provided or from within Cygwin's setup utility.
  3. Picture 3 of How to Set Up a Git Server with SSH on Windows
    Configure OpenSSH:
    1. Open cygwin terminal as admin
    2. Type in 'ssh-host-config -y'
    3. At the end it will create a default user named 'cyg-server' and ask you a new password for that user.
    4. When finished, type in 'net start sshd' to start the openssh server.
  4. Picture 4 of How to Set Up a Git Server with SSH on Windows
    Make sure your install is working as follows:
    1. Open cygwin terminal as admin
    2. Type 'git' to see if git is working.
    3. type 'ssh cyg-server@localhost' to see if you are able to communicate with the server.
Part 2 of 2:

Git Operations with the Server

  1. Picture 5 of How to Set Up a Git Server with SSH on Windows
    On your other computer, you can git ssh the server by specifying 'cyg_server@ip_adress_of_open_ssh_server'.
    1. Example to do on the other machine:
      1. Open git bash and check if openssh server is reachable with the command 'ssh cyg_server@cyg_server@ip_adress_of_open_ssh_server'. If it asks for your password, then you are all set up. Otherwise recheck Part 1 instructions.
      2. Open git bash inside the repository you want to push.
      3. add remote with 'git remote add myRemote ssh://cyg_server@ip_adress_of_open_ssh_server/~/git/remote.git'
      4. push with 'git push MyRemote master'
Update 04 March 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile