Git clone / pull constantly freezes to "Keep key in cache?"

I am trying to clone a repo from my BitBucket account to my laptop running Windows 10 (running GitBash). I followed all the steps necessary to connect (configure your SSH key, confirmed with SSHing git @ bitbucket.org, etc.). However, whenever I try to clone a repo, the tooltip hangs constantly after confirming that I want to cache the Bitbucket key.

User@Laptop MINGW64 /C/Repos $ git clone git@bitbucket.org:mygbid/test.git Cloning into 'test'... The server host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server rsa2 key fingerprint is: ssh-rsa 2048 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40 If you trust this host, enter "y" to add the key to PuTTY 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) y 

No files are cloned, and the result is an empty repo. Trying to initiate the git tag creation wizard from this repo also asks to cache the key, and then hangs without feedback. Although there is no request for key caching when I run test SSH, git operations always ask for the key every time before the failure.

Without error messages that you can work with, I really don't understand what is wrong. I tried several repositions, including very small ones, without any success.

+114
git version-control windows bitbucket ssh
Oct. 20 '15 at 15:02
source share
8 answers

I had this problem when cloning a repo on Windows 10.

I went around it using the Putty GUI for SSH on the server in question (in your case: bitbucket.org), then clicked "Yes" when the request asks if you want to save the server key in the cache. Running the clone command worked for me again!

+137
Oct 22 '15 at 15:59
source share
  • Open putty
  • Enter a host name (e.g. bitbucket.org )
  • Click "Open"
  • Click "Yes" in the popup to cache the host key.
  • Close Putty
+92
Feb 22 '16 at 6:05
source share

To do this from powershell, open a powershell window and paste the following:

 echo y | & 'C:\Program Files (x86)\GitExtensions\PuTTY\plink.exe' -ssh git@github.com echo y | & 'C:\Program Files (x86)\GitExtensions\PuTTY\plink.exe' -ssh git@gist.github.com echo y | & 'C:\Program Files (x86)\GitExtensions\PuTTY\plink.exe' -ssh git@bitbucket.org 

or with standalone version of PuTTY:

 echo y | & 'C:\Program Files (x86)\PuTTY\plink.exe' -ssh git@github.com echo y | & 'C:\Program Files (x86)\PuTTY\plink.exe' -ssh git@gist.github.com echo y | & 'C:\Program Files (x86)\PuTTY\plink.exe' -ssh git@bitbucket.org 

It is also worth knowing that putty stores known hosts in the registry key :

 HKEY_CURRENT_USER\SoftWare\SimonTatham\PuTTY\SshHostKeys 

To shorten this, you can put the following in a .reg file and run it:

 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\SshHostKeys] "rsa2@22:github.com"="0x23,0xab603b8511a67679bdb540db3bd2034b004ae936d06be3d760f08fcbaadb4eb4edc3b3c791c70aae9a74c95869e4774421c2abea92e554305f38b5fd414b3208e574c337e320936518462c7652c98b31e16e7da6523bd200742a6444d83fcd5e1732d03673c7b7811555487b55f0c4494f3829ece60f94255a95cb9af537d7fc8c7fe49ef318474ef2920992052265b0a06ea66d4a167fd9f3a48a1a4a307ec1eaaa5149a969a6ac5d56a5ef627e517d81fb644f5b745c4f478ecd082a9492f744aad326f76c8c4dc9100bc6ab79461d2657cb6f06dec92e6b64a6562ff0e32084ea06ce0ea9d35a583bfb00bad38c9d19703c549892e5aa78dc95e250514069" "rsa2@22:gist.github.com"="0x23,0xab603b8511a67679bdb540db3bd2034b004ae936d06be3d760f08fcbaadb4eb4edc3b3c791c70aae9a74c95869e4774421c2abea92e554305f38b5fd414b3208e574c337e320936518462c7652c98b31e16e7da6523bd200742a6444d83fcd5e1732d03673c7b7811555487b55f0c4494f3829ece60f94255a95cb9af537d7fc8c7fe49ef318474ef2920992052265b0a06ea66d4a167fd9f3a48a1a4a307ec1eaaa5149a969a6ac5d56a5ef627e517d81fb644f5b745c4f478ecd082a9492f744aad326f76c8c4dc9100bc6ab79461d2657cb6f06dec92e6b64a6562ff0e32084ea06ce0ea9d35a583bfb00bad38c9d19703c549892e5aa78dc95e250514069" "rsa2@22:bitbucket.org"="0x23,0xb9b88df3578371a7eb80c78bcda14fb30da436f11ca932a5fd5a8b6adfcc681df7a59cb4cb7ac966d9eac11daa38ebdbc0a6582a210ed4ee95a8d101c4abc925e942ab47535d64f9a5b3b68035c2ea1e900d709a1e8ea938718f532f9805a190446b92bac3040126225ae9d8374bc2008f106979d631734c7453f78c70091f4783b288869cb3c1941a784cd9baad823be27333833dc1f488a45b85952be75cf0a64965662302e3915378dcd5cfcd3ec903d804a29dff2fdf19df5deba4534b09e4dea6e44f152e339b3c43be98ddadfc56533192e216a3d673f00b4aa9cc9e7870acd8b6adb7e0feb77f2292fc2dede94819def3eb1e785541a06ab31ccf725f" 

putty-hosts.reg gist

+20
May 27 '16 at 12:04
source share

I managed to get it to work by running plink directly, after running plink.exe -agent -v git@github.com use the plink.exe -agent -v git@github.com directly - plink.exe -agent -v git@github.com then this git works without freezes.

+4
Oct 23 '18 at 2:39
source share

To get around this, I configured GitBash to use -batch with the -batch option. The option disables all requests - plink will end without freezing and will not add any key fingerprints to the cache.

To add the -batch parameter to the -batch command executed by GitBash, you can set the git config option:

 git config --global core.sshCommand "plink -batch" 

Or set the GIT_SSH_COMMAND environment GIT_SSH_COMMAND .

The output when cloning a repo from an unknown host will be something like this:

 The server host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server rsa2 key fingerprint is: ssh-rsa 2048 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40 Connection abandoned. fatal: Could not read from remote repository. 

After this message, you can add the key to the cache using the command:

 echo y | plink git@bitbucket.org 

NOTE : Please check if there is a plink in your PATH . Alternatively, use a UNIX-like path in the GitBash configuration option, for example:

 /c/Program\ Files/PuTTY/plink.exe -batch 
+2
Jun 03 '18 at 13:22
source share

Even after following the workaround mentioned in other answers, you may encounter an error such as:

FATAL ERROR: Disconnected: no authentication methods supported (server sent: publickey)

To solve both problems at the same time, change git bash to use SSH instead of PuTTY, adding the following to the ~/.profile file ( C:\Users\<Username>\.profile ~/.profile ). If you do not already have this file, create a new file with this line.

 GIT_SSH="/usr/bin/ssh.exe" 

Then open a new git bash window and try your git clone or git pull again.

Please note that for this you may need to create an SSH key if you do not already have one. To do this, follow the instructions on the Bitbucket website.

See this question like this for more information.

+2
Oct. 16 '18 at 2:38
source share

It sounds a little silly, but after trying all of the above, I decided to reinstall Git Bash with the default settings, and it worked.

0
Jun 05 '18 at 12:24
source share

In your git bash shell, check for GIT_SSH:
echo $GIT<tab><tab>
If it exists and has putty, do:
unset GIT_SSH
You might want to put this in one of the git bash startup scripts.
This is NOT a universal solution. This worked in our particular case.

0
May 10 '19 at 17:21
source share



All Articles