Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how SSH keys are selected for gh codespace ssh #7325

Merged
merged 1 commit into from Apr 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkg/cmd/codespace/ssh.go
Expand Up @@ -56,8 +56,14 @@ func newSSHCmd(app *App) *cobra.Command {
The 'ssh' command is used to SSH into a codespace. In its simplest form, you can
run 'gh cs ssh', select a codespace interactively, and connect.

By default, the 'ssh' command will create a public/private ssh key pair to
authenticate with the codespace inside the ~/.ssh directory.
The 'ssh' command will automatically create a public/private ssh key pair in the
~/.ssh directory if you do not have an existing valid key pair. When selecting the
key pair to use, the preferred order is:

1. Key specified by -i in <ssh-flags>
2. Automatic key, if it already exists
3. First valid key pair in ssh config (according to ssh -G)
4. Automatic key, newly created

The 'ssh' command also supports deeper integration with OpenSSH using a '--config'
option that generates per-codespace ssh configuration in OpenSSH format.
Expand Down