Reputation: 111
I am trying to create a gerrit review system and was able to successfully get the gerrit to run on port 8084 and review is being on 29429 port successfully.
When I am trying to run the git clone ssh://user@ip:29429/myrepo.git
I am getting the following error:
Cloning into 'myrepo'...
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 a1:bc:b8:fe:e7:79:c9:34:96:28:7d:6f:d3:3d:af:9b
Connection abandoned.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
When I run ssh -p 29429 user@ip gerrit ls-project
s
Its asking for me to enter my passphrase. When I enter the passphrase
i am able to see myrepo
The following is also fine (making sure the user is ok with gerrit)
$ ssh -p 29429 user@ip
Enter passphrase:
After entering the passphrase I get the following
**** Welcome to Gerrit Code Review ****
Hi user, you have successfully connected over SSH.
Unfortunately, interactive shells are disabled. To clone a hosted Git repository, use:
git clone ssh://user@ipaddress:29429/REPOSITORY_NAME.git
Connection to ip closed.
Please help where is the mistake. Am I doing something wrong or missing something?
Upvotes: 3
Views: 9869
Reputation: 111
The problem is with the Putty and connecting on the port(29429). The thing is two points.
Point 1: if you leave the private key and public key in the .ssh folder of windows, then when u do ssh -p 29429 user@ip, it will ask for passphrase and give you welcome to gerrit code review message.
Point 2. When cloning if you get this 'The server's host key is not cached in the registry etc - Connection abandoned. fatal: Could not read from remote repository." this is caused due to the putty not getting connected on that port.
To resolve this, Please login to the putty on that particular port(29429) then accept the host key (basically clik the yes on pop-up). You need to understand here that it wont let u login(which is perfectly fine). This is just caching the server key.
You may want to remove the ~/.ssh/known_hosts and then try ssh user@ip and login that creates the known_hosts file in your .ssh folder on client(windows machine). but this is not where it is looking. Putty is caching it some other place(I dont know where but it is not here)
Then keep your putty paegent running - load your private key. Then try to clone in git bash. This should be fine.Also ensure the public key generated by Putty Key gen is placed in Gerrit - settings - ssh keys
If you get an exception of Permission denied(public key) then check your gerrit username, it may be empty or invalid(different from your git config settings).
Please make sure when you run git config --global --edit (name and email id should match your gerrit settings).
Upvotes: 6