How to Set Up a Git Server with SSH on Windows

Part 1 of 2:

Install and Set Up Cygwin

  1. How to Set Up a Git Server with SSH on Windows Picture 1
    First, install Cygwin from its website.
  2. How to Set Up a Git Server with SSH on Windows Picture 2
    Then install git and OpenSSH packages, either from the links provided or from within Cygwin's setup utility.
  3. How to Set Up a Git Server with SSH on Windows Picture 3
    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. How to Set Up a Git Server with SSH on Windows Picture 4
    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. How to Set Up a Git Server with SSH on Windows Picture 5
    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'
4.2 ★ | 5 Vote

May be interested