7

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:

enter image description here

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

enter image description here

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

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
mshwf
  • 6,274
  • 12
  • 51
  • 120
  • This is a normal warning that you should expect when you have not connected to the remote device before. – Martin Spamer Feb 19 '17 at 12:17
  • What should I do, I can't download the repo! – mshwf Feb 19 '17 at 12:18
  • And is there a way to register the host's fingerprint? – mshwf Feb 19 '17 at 12:21
  • As the warning message says, select yes and try again. – Martin Spamer Feb 19 '17 at 14:18
  • 1
    This, incidentally, is a PuTTY issue. PuTTY is not part *of* Git, it's just included with some Windows versions of Git because Git needs the operating system to provide "ssh", the "secure shell", and PuTTY can do that. But PuTTY has its own setup. I don't use Windows (and MacOS, Linux, BSD, etc, all have ssh built-in) so I do not know any details about this. – torek Feb 19 '17 at 18:12
  • Again, you don't need putty here, unless you want to add a passphrase to your private key. Was my ssh-keygen suggestion below helpful? Don't forget to read https://stackoverflow.com/help/accepted-answer: I see you have a lot of questions without any answer being accepted. – VonC Jul 29 '17 at 05:36

2 Answers2

7

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.

enter image description here

enter image description here

enter image description here

Antony
  • 1,412
  • 1
  • 12
  • 25
  • Thanks Antony, but I really forget that problem, event I'm no longer using Git (currently using TFS), I remember I solved this problem by re-installing Git extensions and changed the configuration. – mshwf Jul 29 '17 at 06:03
1

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.

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
  • @RezaRahmati Make sure to use a simplified PATH as in https://stackoverflow.com/a/49248983/6309: you will then use the right ssh-keygen command, which does support rsa (in `git\latest\usr\bin\ssh-keygen.exe`). (As opposed to the one in `C:\Program Files\OpenSSH\`, described in https://github.com/PowerShell/Win32-OpenSSH/issues/1001#issuecomment-362929297) – VonC Mar 18 '18 at 10:12