VSCODE_CODE_CLI_TUNNEL_REFERENCE - TerrenceMcGuinness-NOAA/global-workflow GitHub Wiki
Comprehensive guide to
code tunneland related remote server commands
CLI Version: 1.107.1 | Last Updated: December 30, 2025
- Overview
- Quick Start
- Command Hierarchy
- Tunnel Commands
- Related Commands
- Global Options
- Environment Variables
- Use Cases & Examples
- Troubleshooting
The code tunnel command creates secure tunnels to access VS Code remotely through vscode.dev from anywhere. This enables:
- Remote Development: Access your machine's VS Code from any browser
- Port Forwarding: Securely expose local services
- Persistent Connections: Run as a system service for always-on access
- Multi-Machine Management: Register and manage multiple remote machines
# 1. Login with GitHub or Microsoft account
code tunnel user login --provider github
# 2. Start a tunnel (interactive)
code tunnel
# 3. Or start with a custom name
code tunnel --name my-dev-machine
# 4. Access via: https://vscode.dev/tunnel/<machine-name>code
├── tunnel # Main tunnel command
│ ├── prune # Delete stopped servers
│ ├── kill # Stop running tunnel
│ ├── restart # Restart running tunnel
│ ├── status # Check tunnel status
│ ├── rename <name> # Rename machine
│ ├── unregister # Remove machine registration
│ ├── user # Authentication management
│ │ ├── login # Log in to service
│ │ ├── logout # Log out
│ │ └── show # Show current account
│ └── service # System service management (Preview)
│ ├── install # Install as system service
│ ├── uninstall # Remove system service
│ └── log # View service logs
├── serve-web # Run local web VS Code
├── ext # Extension management
│ ├── list # List installed extensions
│ ├── install # Install extension
│ ├── uninstall # Remove extension
│ └── update # Update extensions
├── version # Version management
│ ├── use # Switch editor version
│ └── show # Show current version
├── status # Process diagnostics
└── update # Update CLI
Create a tunnel accessible on vscode.dev from anywhere.
code tunnel [OPTIONS]| Option | Description |
|---|---|
--name <NAME> |
Set machine name for the tunnel service |
--random-name |
Generate a random machine name |
--accept-server-license-terms |
Accept license without prompt |
--no-sleep |
Prevent machine from sleeping while running |
--install-extension <EXT> |
Preload extensions on connecting servers |
--server-data-dir <DIR> |
Directory for server data |
--extensions-dir <DIR> |
Root path for extensions |
--reconnection-grace-time <SECS> |
Reconnection timeout (default: 10800 = 3 hours) |
# Start tunnel with custom name
code tunnel --name dev-workstation
# Start with pre-installed extensions
code tunnel --install-extension ms-python.python --install-extension github.copilot
# Non-interactive start (CI/CD)
code tunnel --accept-server-license-terms --name ci-runner
# Prevent sleep during long sessions
code tunnel --no-sleep --name always-onDelete all servers that are currently not running.
code tunnel pruneStop any running tunnel on the system.
code tunnel killRestart any running tunnel on the system.
code tunnel restartCheck if a tunnel is running on the current machine.
code tunnel statusRename the machine's tunnel identifier.
code tunnel rename <NAME>| Argument | Description |
|---|---|
<NAME> |
New name for the machine |
code tunnel rename production-serverRemove this machine's association with the port forwarding service.
code tunnel unregisterManage authentication for the tunnel service.
code tunnel user login [OPTIONS]| Option | Description |
|---|---|
--provider <PROVIDER> |
Auth provider: microsoft or github
|
--access-token <TOKEN> |
Provide access token directly (env: VSCODE_CLI_ACCESS_TOKEN) |
--refresh-token <TOKEN> |
Provide refresh token (env: VSCODE_CLI_REFRESH_TOKEN) |
# Interactive login with GitHub
code tunnel user login --provider github
# Non-interactive with token
export VSCODE_CLI_ACCESS_TOKEN="ghp_xxxxx"
code tunnel user login --provider github
# Login with Microsoft account
code tunnel user login --provider microsoftcode tunnel user logoutDisplay the currently logged-in account.
code tunnel user show(Preview) Manage tunnel as a system service for persistent connections.
Install or reinstall the tunnel as a system service.
code tunnel service install [OPTIONS]| Option | Description |
|---|---|
--name <NAME> |
Set machine name |
--accept-server-license-terms |
Accept license without prompt |
# Install service with custom name
code tunnel service install --name my-server --accept-server-license-terms
# Service auto-starts on bootStop and remove the tunnel system service.
code tunnel service uninstallView logs from the running service.
code tunnel service logRun a local web version of VS Code (not tunneled).
code serve-web [OPTIONS]| Option | Description |
|---|---|
--host <HOST> |
Listen host (default: localhost) |
--port <PORT> |
Listen port (default: 8000, use 0 for random) |
--socket-path <PATH> |
Unix socket path |
--connection-token <TOKEN> |
Required secret for requests |
--connection-token-file <FILE> |
File containing connection secret |
--without-connection-token |
Disable token (use only if secured otherwise) |
--server-base-path <PATH> |
Base path for web UI |
--server-data-dir <DIR> |
Server data directory |
--commit-id <SHA> |
Specific commit SHA for client |
--accept-server-license-terms |
Accept license without prompt |
# Start local web server on port 3000
code serve-web --port 3000
# Bind to all interfaces (remote access)
code serve-web --host 0.0.0.0 --port 8080 --connection-token mysecret
# Use random port
code serve-web --port 0Manage VS Code extensions.
code ext list [OPTIONS]| Option | Description |
|---|---|
--show-versions |
Display version numbers |
--category <CAT> |
Filter by category |
code ext install [OPTIONS] <ext-id | path>...| Option | Description |
|---|---|
--pre-release |
Install pre-release version |
--force |
Update to latest if already installed |
--donot-include-pack-and-dependencies |
Skip pack/dependency installation |
# Install by ID
code ext install ms-python.python
# Install specific version
code ext install [email protected]
# Install from VSIX file
code ext install ./my-extension.vsix
# Install pre-release
code ext install github.copilot --pre-release
# Force update
code ext install ms-python.python --forcecode ext uninstall <ext-id>...code ext updateManage VS Code editor versions.
code version showcode version use <stable | insiders | x.y.z | path># Use stable channel
code version use stable
# Use insiders
code version use insiders
# Use specific version
code version use 1.85.0
# Use custom installation
code version use /opt/vscode-customThese options apply to all code commands:
| Option | Description |
|---|---|
--cli-data-dir <DIR> |
CLI metadata directory (env: VSCODE_CLI_DATA_DIR) |
--verbose |
Enable verbose output (implies --wait) |
--log <LEVEL> |
Log level: trace, debug, info, warn, error, critical, off
|
-h, --help |
Print help information |
-V, --version |
Print version |
| Variable | Description | Used By |
|---|---|---|
VSCODE_CLI_DATA_DIR |
CLI metadata storage directory | All commands |
VSCODE_CLI_ACCESS_TOKEN |
Authentication access token | tunnel user login |
VSCODE_CLI_REFRESH_TOKEN |
Authentication refresh token | tunnel user login |
# Initial setup on dev server
code tunnel user login --provider github
code tunnel service install --name dev-server --accept-server-license-terms
# Access from anywhere at: https://vscode.dev/tunnel/dev-server#!/bin/bash
# Non-interactive tunnel for CI debugging
export VSCODE_CLI_ACCESS_TOKEN="${GITHUB_TOKEN}"
code tunnel user login --provider github
code tunnel --name "ci-${BUILD_ID}" --accept-server-license-terms &
echo "Debug at: https://vscode.dev/tunnel/ci-${BUILD_ID}"# On HPC login node
code tunnel --name hera-login --no-sleep
# On compute node (via job script)
code tunnel --name hera-compute-${SLURM_JOB_ID} --accept-server-license-terms# Machine 1: workstation
code tunnel --name workstation
# Machine 2: server
code tunnel --name prod-server
# Machine 3: laptop
code tunnel --name laptop
# Access any at: https://vscode.dev/tunnel/<name># Stop current tunnel
code tunnel kill
# Remove stale servers
code tunnel prune
# Unregister from service
code tunnel unregister# Check status
code tunnel status
# View verbose logs
code tunnel --verbose --log debug
# Restart tunnel
code tunnel restart# Check current login
code tunnel user show
# Re-authenticate
code tunnel user logout
code tunnel user login --provider github# Check service logs
code tunnel service log
# Reinstall service
code tunnel service uninstall
code tunnel service install --name my-server# For serve-web, use random port
code serve-web --port 0For debugging, increase verbosity:
code tunnel --log trace --verbose 2>&1 | tee tunnel.log| Task | Command |
|---|---|
| Start tunnel | code tunnel --name <name> |
| Stop tunnel | code tunnel kill |
| Check status | code tunnel status |
| Rename machine | code tunnel rename <name> |
| Login | code tunnel user login --provider github |
| Logout | code tunnel user logout |
| Install service | code tunnel service install |
| Uninstall service | code tunnel service uninstall |
| View service logs | code tunnel service log |
| Clean up | code tunnel prune && code tunnel unregister |
| Local web server | code serve-web --port 8000 |
| Install extension | code ext install <id> |
| List extensions | code ext list --show-versions |
Generated from code tunnel --help on VS Code CLI 1.107.1