Reputation: 1093
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 "[email protected]"
then I opened the public key by
!cat /root/.ssh/id_rsa.put
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
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.
[email protected]: Permission denied (publickey).
What do I do next?
Upvotes: 7
Views: 2262
Reputation: 1323055
ssh -T github.com
[email protected]: Permission denied (publickey)
That would be expected:
the right test would be:
ssh -T [email protected]
the right SSH URL to use with GitHub would be:
[email protected]:<me>/<myRepo>
You always use "git
", not "root
" (or your current local user) as the remote user to connect to GitHub.
Your local account remains "root
" (it contains the public and private SSH key)
But connecting to GitHub means using the remote account git
.
Upvotes: 3