π§ͺ The extension is currently in Preview stage, so some hiccups are expected. Please help us to improve by submitting feedback!
This GitHub CLI extension allows to bridge network between a Codespace and your local machine, so the Codespace can reach out to any remote resource that is reachable from your machine. In another words, it uses your local machine as a network gateway to get to those resources.
For instance, if you are using a VPN to connect to your enterprise network to access a database or any other remote resources on the private network, this extension allows you to get to those resources from within a Codespace, so that you can develop fully inside a Codespace!
-
This extension depends on the latest features of GitHub CLI(>= v2.8.0), please make sure to upgrade it. If run the
gh codespace selectcommand opens the codespace selection dialog, you are good to go. -
The extension relies on
gh codespace sshcommand to establish SSH tunnel to a Codespace, hence you need to setup ssh keys if you didn't before. If you can dosudo gh codespace ssh(sudois important since kernel might use different identity under non-root user) and connect to a Codespace successfully, - you are good to go. Refer to Generating a new SSH key and adding it to the ssh-agent for more info. List of known issues and workarounds for them can be found here. -
If your codespace uses a non-default image, ensure that both the GitHub CLI and an SSH server are installed inside the codespace.
One way to install these prereqs on a debian-based image is by adding the following to the features property of your devcontainer.json file.
Rebuild the codespace to apply the newly added dev container features.
Mac OSx:
gh extension install github/gh-netLinux:
sudo gh extension install github/gh-netThe sudo is required during extension installation on Linux due to cli/cli#5456. Hopefully it won't be the case in the future.
To start network forwarding from a Codespace to a local machine, run:
sudo gh net start
β οΈ Note: If you set apassphrasefor yourSSHkeys, you will need to pass--gui falseCLI option, otherwise you won't be able to connect. This will be fixed in future releases.
This will provide codespace selection dialog:
Select a codespace and press enter. The extension will connect to selected codespace and start forwarding network traffic:
There are two pannels in the connected view of the extension:
- Panel on the left (
NAT) shows the network address translation table for currently opened connections. For stateful protocols(e.g.TCP) the records are cleaned up automatically after connection is closed so the records will come and go as connection is established and closed. For stateless protocols (e.g.UDPorICMP) or unsuccessfulTCPconnections the records are cleaned up after some time, so those will show up in the list for some time. - Panel on the right (
DNS) shows the resolvedDNSrecords, ashostname,recordandtime-to-live(TTL) values.
Press q or ctrl + c to stop the extension.
--gui: Enanble/disable GUI mode. [true|false] [default:true]--dns: Enanble/disable DNS resolution. [true|false] [default:true]--trace: Specify tracing verbosity. [none|trace|debug|info|warn|error] [default:info]
Run gh net start -h for details.
| Architecture | Local |
|---|---|
| Intel | β |
| Apple silicon | β |
| Distro | Local | Inside Codespace |
|---|---|---|
| Ubuntu | β | β |
| Debian | β | β |
| Fedora | ? | β |
| Red Hat | ? | β |
| Mint | ? | β |
| OpenSUSE | ? | β |
| Centos | ? | β |
| Kali | ? | β |
| Arch | ? | β |
| Alpine | ? | β |
| Version | Local |
|---|---|
| Windows 10 | π |
| Windows 11 | π |
| Name | Status |
|---|---|
| Viscocity | β |
| GlobalProtect | β |
| NordVPN | β |
| Tailscale | β |
Legend: β
- currently supported π - in progress ? - unknown / not tested
For list of supported network protocols refer to this doc.
- Something is missing? Please create a β¨ feature request.
- Something is incorrect? Please create a π bug report.
- For list of known issues refer to π this doc or π this list.

