The fingerprint of this host is not registered by

2020-06-17 06:58发布

问题:

I'm a quite beginner in using Git (cmd, and UI clients),
I installed Git extensions, set up all requirements.
When I tried to connect to a repository on BitBucket, private account (I used my own ppk that I have on my computer), I get this message:

When I click on Yes I'm presented with a Git window:

Can anyone help me get over this so I can clone repositories?

回答1:

Open the command prompt or Git bash and run the following command, where the bracketed term is the username and SSH path of your BitBucket repository:

plink [git@bitbucket.org:company/repo-name.git]

If "plink" is an unrecognized command, make sure the following entries exist in your PATH environment variable and add any that are missing:

  • C:\Program Files (x86)\Git\bin
  • C:\Program Files (x86)\Git\cmd
  • C:\Program Files (x86)\GitExtensions
  • C:\Program Files (x86)\GitExtensions\PuTTY

These are accurate as of GitExtensions version 2.50.01. If Putty is installed elsewhere, add that folder path to the PATH variable. Restart GitExtensions after updating environment variables.



回答2:

First, make sure that <git>/usr/bin is added to your PATH (in addition of <git>/bin, with <git> being the PATH where you installed Git)
And use the latest Git for Windows.

Second, don't use putty. As explained in BitBucket (for bitbucket.com, but that applies to a BitBucket server too), all you need is ssh-keygen.

ssh-keygen -t rsa -C "key for BitBucket access" -q -P ""

That will create an id_rsa and id_rsa.pub in your $HOME/.ssh (with $HOME, on Windows, being set by default by Git cmd or Git bash to your %USERPROFILE%: C:\Users\myLogin)

Copy the content of id_rsa.pub (the public key) to your profile in your BitBucket server.

Then try a ssh -T git@yourBitBucketServer: if it asks you to register the server, answer 'y' (yes): your $HOME/.ssh/known_hosts will be updated.
Try again an ssh -T git@yourBitBucketServer and it should work without any more prompt.