Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Win console hangs after trying to clone a git repo [duplicate]

I have a remote repo which I want to clone. I've set up pageant.exe and added private key. Also added GIT_SSH variable which points to plink.exe. And after clone command I get such output

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.
...
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)

When typing y or n nothing happens, console just hangs and I have to terminate the command with Ctrl+C

Why this happens and how to fix this?

like image 978
maks Avatar asked Nov 13 '15 10:11

maks


People also ask

What happens if you copy a git repo?

Cloning a repository pulls down a full copy of all the repository data that GitHub.com has at that point in time, including all versions of every file and folder for the project. You can push your changes to the remote repository on GitHub.com, or pull other people's changes from GitHub.com.

Can you clone a git repository twice?

This can be annoying as running tests blocks you from picking up the next story -- but it doesn't have to be that way! Simply clone your project's repo twice (or even more often). When your work on a feature branch is done, simply push that branch and check it out on your 2nd copy to run tests there.

How do I resume a git clone?

No, cloning cannot be resumed, if it's interrupted you'd need to start over. If you suspect that there's a good chance that your clone may be interrupted, look for a git bundle that you can download using a protocol that can be resumed.


1 Answers

After several hours of investigation I finally found a solution. The putty has to know smth about the host you're connecting to, namely host must be known_host to putty. Putty stores information about know_hosts under HKEY_CURRENT_USER\SoftWare\SimonTatham\PuTTY\SshHostKeys registry key. To force putty to add information about that host to registry key we can by accessing via putty.exe using your private key. On first access putty will ask you to add that host to known_hosts. After that git clone command finishes successfully.

Maybe this will be helpful for somebody, because it's not obvious from the first glance

like image 52
maks Avatar answered Oct 23 '22 04:10

maks