Search code examples
gitgithubgithub-codespaces

How to connect to git code spaces via ssh from another machine?


I have git code space

I want to use my other machine MacBook Pro to connect to that specific git code space via ssh

How do I do that ?


Solution

  • You can try first to install and use the GitHub CLI gh (see installation)

    From there, following SSH into a codespace

    gh codespace ssh -c CODESPACE-NAME
    

    Note: The codespace you connect to must be running an SSH server.

    The default container image includes an SSH server, which is started automatically.

    If your codespaces are not created from the default image, you can install and start an SSH server by adding the following to the features object in your devcontainer.json file.

    "features": {
       ...
       "ghcr.io/devcontainers/features/sshd:1": {
           "version": "latest"
       },
       ...
    }