1

I am trying configure git server and client using two windows(both with windows 10 os) machines. So, I downloaded git Git-2.18.0-64-bit.exe file and installed on both the machine. First I created the user and email using below commands on client machine:

git config --global user.name "rams" and git config --global user.email "ramsxyz@gmail.com" respectively.

Then I created empty repository on client in myrepo.git directory using git init command.

Then I created server reposityory using git init --bare on server machine.

Then on I added remote server repository to client on client machine using remote add origin username@ipaddress:/Users/rams/myrepo.git command.

Then I created a README.txt file on myrepo.git direcotry on client machine and added to staging using git add README.txt command.

Then I tried to commit the file using git commit -m "added initial version" command.

After that I tried to push the README.txt file to server repository using git push origin master. But, it ended up with giving the below error:

"ssh: connect to host 10.208.23.161 port 22: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists."

I tried to fix this by turning of my firewall on client machine to avoid blocking of port 22. But, still it is not fixed.

Any help or suggestion to fix this problem is appreciated. Thanks in advance.

Parashuram
  • 303
  • 2
  • 6
  • 19
  • You haven't set up the remote service correctly. Given that it says "connection refused" it sounds like there's a firewall in the middle, the ssh service is not working, it's working on another port or who knows what in that direction. Does the remote server have ssh working properly? Ca you connect to it with ssh independently of git? – eftshift0 Sep 25 '18 at 04:56
  • Oh.... and turning off the firewall on the client machine does no difference. It's the ssh server that has to allow access to the ssh service so you better check on the other side how the firewall is set up. But as I said, can you connect to ssh "standalone"? If that is not possible, I don't think trying to use git with ssh as a transport will work. – eftshift0 Sep 25 '18 at 04:58

1 Answers1

0

You must check first that ssh -Tv username@ipaddress will work, which means:

  • you have a running SSH server on server2
  • you have generated a public/private key on server1
  • you have added that public key on server2 %USERPROFILE%\.ssh\authorized_keys
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250