How to configure git server and client repositories on twol local windows systems?

117 views Asked by At

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 "[email protected]" 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.

1

There are 1 answers

0
VonC On

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