0

Its been 2 days I'm struggling to setup git repo server locally, I have two computers setup with windows 10 pro running on same network. Lets say I want to setup computer ABC as server and XYZ as client. My goal is to maintain code on XYZ (client computer) from where I will push branch to Server computer.

I started with this git-scm.com page, I understand that those instructions were specific to Linux, on further searching I found that I can install OpenSSH Clinet and Server on windows to setup git locally.

I installed git and OpenSSH Server on ABC computer, I enabled to auto run services OpenSSH Server and Agent. On client computer I created folder under windows users folder c:\Users\xyz\.ssh\ and I run the command ssh-keygen to generate the keys, I copied the public key to c:\users\abc\.ssh\ folder and renamed file to authorized_keys on client computer I left default name as is id_rsa

On Server I edited sshd_config file in c:\ProgramData\ssh to enable public key and some other config based on whatever help I found on the internet. To test SSH connection when I run command ssh abc@abc_computername from Client computer it got connected right away.

Now it was the time to test it with git, I setup environment variable GIT_SSH set path to C:\WINDOWS\System32\OpenSSH\sshd.exe I created a repo on server matchine git init --bare project.git on client server, I created a folder myrepo where I initiated a new git repo, I added a new text file to it, staged it and committed it. After that when I try to push this code to server by using below command. (please note that repo path on the server is f:\code\project.git)

 >git remote add origin ssh://abc@abc_computer:/f:/code/project.git 
 >git push origin master 

I get the error that git was not able to find any git repo or you do not have permission to access the folder.

does not appear to be a git repository fatal: Could not read from remote repository.

I double checked everything user abc has full access to .ssh folder, code & project.git folder

Later I also disabled OpenSSH Server and reinstalled git on server machine by enabling OpenSSH in git installation wizard and I configured everything related to SSH in git installation folder like sshd_config but no luck, Please note that computers are in work group and have separate users, as its been two days I have been try a lot of possibilities like creating same user on host machine, ssh-add to add key, start-ssh-agen to run git ssh agent, I added user name and email for both client and server git repo config file, Firewall is disabled on both computers. I been searching on stackoverflow I and came across 100s of examples and issue but I was not able to get it done.

Additionally I want to know can I ensure that Git configured in a way that it listens to ssh requests on server, I tried to find but until now I was not able to find any example that explains that how to tell Git that it should listen to which instance/setup of sshd.exe.

Tauha
  • 99
  • 1
  • 12

0 Answers0