Home > Net >  How do I SSH into github codespace provided by CS50
How do I SSH into github codespace provided by CS50

Time:01-11

I have a codespace provided by CS50. I want to ssh into it using my local terminal. I installed github-cli. When I run gh cs list It shows the codespace :

NAME                                                     DISPLAY NAME            REPOSITORY       BRANCH  STATE      CREATED AT
roshanpaudel111-literate-space-sniffle-g6x64ww79x9cvgg9  literate space sniffle  code50/65642985  main    Available  6d

But when I try to ssh into it using this command gh cs ssh roshanpaudel111-literate-space-sniffle-g6x64ww79x9cvgg9, it shows the following output:

? Choose codespace: code50/65642985 (main): literate space sniffle
ubuntu@localhost: Permission denied (publickey,password).
shell closed: exit status 255

How can I solve this issue? The whole process looks like this :

linux@linux ~ $ gh cs list
NAME                                                     DISPLAY NAME            REPOSITORY       BRANCH  STATE      CREATED AT
roshanpaudel111-literate-space-sniffle-g6x64ww79x9cvgg9  literate space sniffle  code50/65642985  main    Available  6d
linux@linux ~ $ gh cs ssh roshanpaudel111-literate-space-sniffle-g6x64ww79x9cvgg9
? Choose codespace: code50/65642985 (main): literate space sniffle

ubuntu@localhost: Permission denied (publickey,password).
shell closed: exit status 255
linux@linux ~ [1] $

CodePudding user response:

Double-check the format of the private key you registered in GitHub Codespaces.

It should start with -----BEGIN OPENSSH PRIVATE KEY----- and ends with -----END OPENSSH PRIVATE KEY----- (meaning a non-encrypted private key)
The EOL (end of lines) used in that file should be LF (not the Windows CRLF), although if you copy-pasted its content directly, it should be fine.

See also the process followed in cs50/codespace issue 62.


The OP Rosan Paudel adds in the comments:

I think it works with the codespaces that we create manually.
I was trying to ssh into a codespace that is provided by cs50 which is in my repository.
Whenever I run update50 it screws up everything. So I have to backoff doing any tweaks.

  • Related