gh-cs
Access GitHub Codespaces
TLDR
View documentation for the original command
SYNOPSIS
gh codespace command [flags]
PARAMETERS
create
Creates a new codespace for a repository.
list
Lists all your active codespaces.
delete
Deletes one or more codespaces.
ssh
Connects to a codespace via SSH.
cp
Copies files between your local machine and a codespace.
forward
Forwards a local port to a codespace port.
logs
Accesses and displays codespace logs.
ports
Lists forwarded ports in a codespace.
rebuild
Rebuilds a codespace, applying new configurations.
stop
Stops a running codespace.
DESCRIPTION
The gh codespace command, often referred to as gh-cs (due to the built-in cs alias for codespace), is a core component of the GitHub CLI (Command Line Interface) designed for managing GitHub Codespaces.
Codespaces provide configurable, cloud-hosted development environments that can be accessed directly from your web browser or through popular IDEs like VS Code. This command streamlines the workflow for developers by enabling terminal-based interaction with these environments.
Users can perform a wide range of actions, including creating new codespaces, listing existing ones, connecting to them via SSH, copying files, forwarding network ports, and managing their lifecycle (e.g., stopping or deleting). It's an essential tool for those leveraging cloud-based development, offering a seamless and efficient way to set up and tear down isolated development environments without impacting local machine configurations.
CAVEATS
The use of gh-cs implies the gh codespace command, which requires the GitHub CLI to be installed and properly authenticated with your GitHub account. Active internet connectivity is necessary for all operations. Be mindful of billing implications associated with Codespaces usage, as they consume resources and may incur costs based on usage and configuration.
ALIAS INFORMATION
While the full command is gh codespace, GitHub CLI provides a convenient alias, cs, allowing users to execute subcommands more concisely (e.g., gh cs create). The usage of gh-cs often implies this alias in scripting or custom configurations.
ENVIRONMENT VARIABLES
Several environment variables can influence the behavior of gh codespace commands, such as GH_HOST (to specify a GitHub Enterprise instance) or GH_CODESPACES_REGION (to prefer a specific region for codespace creation). These can be used to customize interactions and target specific environments.
HISTORY
GitHub Codespaces was first introduced as a limited beta feature in 2020 and became generally available in 2021, signifying GitHub's strategic move into cloud-native development environments. The integration of gh codespace into the GitHub CLI was crucial for providing developers with a robust command-line interface to manage these cloud resources, aligning with the growing trend of infrastructure-as-code and remote development workflows.