Skip to content

Add railway ssh config for OpenSSH client config blocks#905

Draft
m-abdelwahab wants to merge 3 commits into
masterfrom
mahmoud/ssh-config-subcommand
Draft

Add railway ssh config for OpenSSH client config blocks#905
m-abdelwahab wants to merge 3 commits into
masterfrom
mahmoud/ssh-config-subcommand

Conversation

@m-abdelwahab
Copy link
Copy Markdown
Collaborator

Summary

Adds railway ssh config, a new subcommand that emits an OpenSSH client config block for a Railway service.

This unlocks tools that read ~/.ssh/config, including VS Code Remote-SSH, Cursor, Zed, JetBrains Gateway, scp, rsync, and sshfs.

What changed

  • Added railway ssh config

    • prints a config block to stdout by default
    • supports --write to idempotently upsert a marked block into ~/.ssh/config
    • supports --remove to delete the marked block
    • supports --path for alternate config files
    • supports --alias for custom Host aliases
    • supports -i/--identity-file
  • Reuses the existing SSH resolution path to resolve project, environment, and service.

  • Uses the stable ServiceInstance.id as the OpenSSH User.

  • Writes config changes atomically and sets Unix SSH config permissions.

  • Allows --remove -s <service> to remove local blocks without requiring live service resolution.

  • Quotes IdentityFile paths when needed.

Help text

Emit or manage an OpenSSH config block for a service

Usage: railway ssh config [OPTIONS]

Options:
  -p, --project <PROJECT>          Project to connect to (defaults to linked project)
  -s, --service <SERVICE>          Service to connect to (defaults to linked service)
  -e, --environment <ENVIRONMENT>  Environment to connect to (defaults to linked environment)
      --alias <ALIAS>              Host alias to use in the SSH config
  -i, --identity-file <PATH>       Path to identity (private key) file to use
      --write                      Upsert the generated block into the SSH config file
      --remove                     Remove the generated block from the SSH config file
      --path <PATH>                SSH config file to update [default: ~/.ssh/config]
  -h, --help                       Print help
  -V, --version                    Print version

@m-abdelwahab m-abdelwahab added the release/minor Author minor release label May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/minor Author minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant