whitebear
whitebear

Reputation: 12445

SSH key from google colab

I want to use git clone on google colab

First, I tried to git [email protected]:/~/myGit/myproj.git

However it shows ssh error (of course)

Cloning into 'myproj'...
Host key verification failed.
fatal: Could not read from remote repository.

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

So one idea, create ssh key every time and put to server's authorized_keys file???

!ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ObNjcAokQn16AMm/ppPq8A4VGUDFKjr3Ck17wrNllMw root@6ef89c7a5cd3
The key's randomart image is:
+---[RSA 2048]----+
|+=B.             |
|.o * .           |
|. * =            |
|.o O o   .       |
|o o E . S        |
|o=.= . + +       |
|+oX.+ . +        |
|.B B.  . .       |
|+o*.             |
+----[SHA256]-----+

However I am not sure where ssh key goes and what should I do next.

Also I guess my first idea was wrong.

does anyone help??

Upvotes: 1

Views: 3226

Answers (1)

Jazz
Jazz

Reputation: 26

ssh key can be found at this folder /root/.ssh/id_rsa.pub

Go to github > settings > ssh and gpg_keys

Add new ssh key

Refer here https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

Upvotes: 1

Related Questions