steps to clone a private repository using Google Colab

use*_*493 5 github google-colaboratory

I want to clone a private repository in Google Colab,

I opened a notebook on colab and did the following:

%cd "content/drive/My Drive/project"
!rm -rf /root/.ssh*
!mkdir /root/.ssh
!ssh-keygen -t rsa -b 4096 -C "githubname@github.com"
Run Code Online (Sandbox Code Playgroud)

then I opened the public key by

 !cat /root/.ssh/id_rsa.put
Run Code Online (Sandbox Code Playgroud)

I copied the public key that is displayed after I ran the command and made a new key in my GitHub using this key.

Then I tried the following:

!ssh-keyscan GitHub.com >> /root/.ssh/known_hosts
!chmod 644 /root/.ssh/known_hosts
!chmod 600 /root/ssh/id_rsa
!ssh -T github.com
Run Code Online (Sandbox Code Playgroud)

then I get the following (permission denied)

# github.com:22 SSH-2.0-babeld-d45c1532
# github.com:22 SSH-2.0-babeld-d45c1532
# github.com:22 SSH-2.0-babeld-d45c1532
Warning: Permanently added the RSA host key for IP address '140.82.113.3' to the list of known hosts.
root@github.com: Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)

What do I do next?

Von*_*onC 3

ssh -T github.com
root@github.com: Permission denied (publickey)
Run Code Online (Sandbox Code Playgroud)

这是预期的:

您始终使用“ git”,而不是“ root”(或您当前的本地用户)作为连接到 GitHub 的远程用户。

您的本地帐户仍为“ root”(它包含公共和私人 SSH 密钥)

但连接到 GitHub 就意味着使用远程帐户git