How to use GIT and SSH on Windows

The original question:

Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists

The answer:

Before the first checkout in Komodo, i should have used the git bash (clone a repo), because git bash makes a file ( ~/.ssh/known_hosts) contains the accepted host.

Then i can checkout.

So if someone would like to use Komodo IDE with private GIT repo and SSH Key:

  • Download GIT (http://git-scm.com/download/win)
  • Install GIT (with GIT Bash / you can check it on install)
  • Start Menu -> Run -> cmd
    In the command line type:
git config --global user.name "John Doe"
git config --global user.email "johndoe@doebrothers.com"
  • Start menu, type and run Git Bash
  • In the Git Bash Screen type:
ssh-keygen –t rsa –C "johndoe@doebrothers.com" //the e-mail address is your git providers login e-mail address/username
clip < ~/.ssh/id_rsa.pub //This will copy your public key to your clipboard
  • Your have to add your public key to your Git provider’s website (paste or upload it)

  • In the Git Bash Screen clone a repo. That will create the known_hosts file.

  1. In Komodo, go to Preferences -> Source Code Control-> Git
    Add the git.exe path

Done

Source
http://guganeshan.com/blog/setting-up-git-and-tortoisegit-with-bitbucket-step-by-step.html


Hi!

I would like to use Komodo IDE with bitbucket private GIT repository.
I generated the key with puttygen, and i can see the key in the pageant (pageant is running).
I succesfully connect to my repository with putty.

The git.exe path is ok in the Komodo preferences.

When i try to checkout, i get that error:
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I checked the keys in the registry, i found my fingerprint here:
HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys
rsa2@22:bitbucket.org

Please help me resolve this problem.

Peter

Hi @pitt,

How are you connecting to the server that confirms it’s working? Are you performing a git checkout? Or are you connecting over SSH?

Please confirm the former if you haven’t tried it.

  • Carey

Hi!

I use the GIT icon and i choose the Checkout from the dropdown menu. But its isnt works.

Then i try connect with putty to the server, and it was ok.

yes I got that. When you confirmed that PuTTY can connect to your server, are you using GIT? Or are you connecting over SSH? NOTE: I’m not asking about Komodo. I’m asking for confirmation that git checkout works outside of Komodo.

  • Carey

Ahh sorry, im new with git :smile:
Yes i connected over SSH when it was ok.
But it seems my Avast (antivirus,firewall) let only putty use SSH port, because i switched off my Avast and i get other error message:
ssh_exchange_identification: Connection closed by remote host
As i see now bitbucket.org offline. Do you reach the domain? I get 500error. I think beacuse i try to connect unsuccessfull the server banned my ip address :S

I’m not sure that BitBucket has the “ban an IP if there were some unsuccessful connections from it” policy. https://bitbucket.org works fine for me (at least a landing page). Try to disable Windows Firewall or any other firewall and see if you’re able to reach the domain.

Strange i try with my other internet connection, and i get 500 error on the landing page…

Ok, i’ve found the solution!

Before the first checkout in comodo, i should have used the git bash (clone one repo), because git bash makes a file ( ~/.ssh/known_hosts) what contents the accepted host.

Then i can checkout.

So if someone would like to use Komodo IDE with private GIT repo and SSH Key:

  1. Download GIT (http://git-scm.com/download/win)

  2. Install GIT (with GIT Bash / you can check it on install)

  3. Start Menu -> Run -> cmd
    In the command line type:
    git config --global user.name “John Doe”
    git config --global user.email "johndoe@doebrothers.com"

  4. Start menu, type and run Git Bash

  5. In the Git Bash Screen type:
    ssh-keygen –t rsa –C "johndoe@doebrothers.com"
    //the e-mail address is your git providers login e-mail adrress/username

clip < ~/.ssh/id_rsa.pub //This will copy your public key to your clipboard

  1. Your have to add your public key to your Git provider’s website (paste or upload it)

7.!!! In the Git Bash Screen clone one of the repo. That will make the kown_hosts file.

  1. Komodo Ide Preferences ->Source Code Control->Git
    Add the git.exe path

Done

Soruce
http://guganeshan.com/blog/setting-up-git-and-tortoisegit-with-bitbucket-step-by-step.html

K that’s great you figured it out.

Another clarification. @pitt, you were testing two different things. PuTTY SSH and then Git Checkout which are in no way related. Git has it’s own SSH executable hidden away in it’s install directory.

For people that come across this; Don’t use PuTTY with Git(you can if you want obviously but i don’t recommend it). It’s a pain in the butt.

Thanks for posting your solution @pitt. That is awesome. That will definitely help someone in the future.

  • Carey

@pitt, I’ve edited your first post because you moved the topic under Tutorials category, now it contains the question, the answer and the raw question that was the content of the first post before I’ve edited it. Thanks for the solution though.

@careyh : Yes, i know. I try both of ssh/putty method, I started with putty, but i found the solution only the SSH way :smile: Thx the clarification!
In the future i wont use the putty way.

I will forget the solution, i will very happy when i have to reintall my op.system, and i can remember with this forum :slight_smile:

@Defman: U are a gentlemen, thx!