LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gh-cs

shorthand for codespaces management

TLDR

Create a codespace for a repository
$ gh cs create -R [owner/repo]
copy
List codespaces
$ gh cs list
copy
Connect to codespace via SSH
$ gh cs ssh -c [codespace-name]
copy
Open codespace in VS Code
$ gh cs code
copy
Stop a running codespace
$ gh cs stop -c [codespace-name]
copy
Delete a codespace
$ gh cs delete -c [codespace-name]
copy
Copy files from codespace to local machine
$ gh cs cp remote:[/path/to/file] [local/path]
copy

SYNOPSIS

gh cs command [options]

DESCRIPTION

gh cs is the shorthand alias for gh codespace, managing GitHub Codespaces from the command line. Codespaces are cloud-hosted development environments that provide a full VS Code experience with configurable compute resources.
The command enables creating, connecting, and managing codespaces without visiting github.com. It supports SSH connections for terminal access, integration with local VS Code installations, and file copying between local and remote environments.

PARAMETERS

create

Create a new codespace.
list
List available codespaces.
ssh
SSH into a codespace.
code
Open codespace in Visual Studio Code.
stop
Stop a running codespace.
delete
Delete codespaces.
ports
List and manage port forwarding.
cp
Copy files between local and remote file systems.
logs
Access codespace logs.
rebuild
Rebuild a codespace.
view
View details about a codespace.
jupyter
Open a codespace in JupyterLab.
edit
Edit a codespace.
-c CODESPACE, --codespace CODESPACE
Target codespace name. If omitted, a list is displayed for selection.
-R REPO, --repo REPO
Repository for new codespace.
--help
Display help information.

CAVEATS

Requires GitHub account with Codespaces access. Usage may incur charges. Codespaces have timeout and retention limits.

HISTORY

gh cs was added to the GitHub CLI to support Codespaces, GitHub's cloud development environment launched in 2020.

SEE ALSO

gh(1), gh-codespace(1), gh-repo(1), code(1)

Copied to clipboard
Kai