0

Having problems cloning git repository to a new pc.

On the new pc, I ran ssh_keygen as follows

ssh-keygen -t rsa -C "laptop"

And I copied it to the clipboard using:

cat ~/.ssh/id_rsa.pub > /dev/clipboard

Than I went to gitlab profile settings and added a ssh key.
When I try to clone from intellij I get

clone failed. Could not read from remote repository

When I run from cli git clone using

git clone git@mygitlab:myproj/myproj.git 

I get

The authenticity of host 'ilgitlab (10.10.0.158)' can't be established.

The initial clone succeeds when i choose 'yes' but the integration with Intellij doesn't behave well.

I am working with a vpn (cisco anyconnect).

Bick
  • 17,833
  • 52
  • 146
  • 251

2 Answers2

2

You can automate updating ssh/known_hosts file by running a command like this. ssh-keyscan github.com >> .ssh/known_hosts

After this, the next time you run the git clone, it would have the host already in the known_hosts file.

Rajeesh ck
  • 21
  • 3
1

The yes if for the first clone to add the key to the know hosts, you should do the first one manually and the second one and on should pass without any problems,

It should be a message like this one:

enter image description here

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • Thanks. I did. Intellij still not able to clone after known_host file was updated with the gitlab server. – Bick Apr 17 '16 at 20:36
  • try this: open git bash and execute this: `eval $(ssh-agent)` and now try intellij again – CodeWizard Apr 17 '16 at 20:44