GH-CODESPACE-PORTS-FORWARD(1)

πŸ’… GH-CODESPACE-PORTS-FORWARD(1) β€” the GitHub CLI manual, bestie edition πŸŽ€

okay so picture this: it's the gh manual page, it's GitHub CLI manual, and today's main character is the port-forwarding one. let's get into it ✨


🌸 NAME 🌸

gh-codespace-ports-forward β€” literally just forwarding ports, that's the whole vibe 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

gh codespace ports forward <remote-port>:<local-port>... [flags]

notice the ... bestie, you can stack these. multiple port pairs, that's the assignment πŸ’…

✨ DESCRIPTION ✨

So what does it do? It forwards ports from a codespace to your local machine. That's it. That's the whole thing. Your codespace has a port, your laptop wants it, this command is the matchmaker πŸ”₯

Now here's the tea: ports bind to loopback (127.0.0.1) by default. So by default, only your own machine can reach them. if you want the whole network to see it, you use --all-interfaces to bind to all interfaces β€” and yes that's a vibe change, not just a detail 🌈

πŸŽ€ OPTIONS πŸŽ€

  • --all-interfaces β€” listen on all network interfaces. the "let everyone in" option 🫢 (remember, the default is loopback-only 127.0.0.1, so this is the delulu version)

πŸ‘‘ OPTIONS INHERITED FROM PARENT COMMANDS πŸ‘‘

these are the family hand-me-downs, they come from the parent command and they're iconic fr fr:

  • -c, --codespace <string> β€” the name of the codespace. which one are we talking to, bestie πŸ¦‹
  • -R, --repo <string> β€” filter codespace selection by repository name, in user/repo form
  • --repo-owner <string> β€” filter codespace selection by repository owner (that's a username or an org, either one works πŸ’œ)

πŸ’€ EXIT CODES πŸ’€

the vibe check at the end. here's what the numbers mean:

  • 0 β€” successful execution. slay, it worked ✨
  • 1 β€” error. something went sideways 😭
  • 2 β€” command canceled. you (or something) hit the brakes πŸ™ˆ
  • 4 β€” authentication required. you gotta log in first, no cap πŸ”‘
NOTE: specific commands may have additional exit codes. Refer to the command's help for more information. (iykyk β€” check the help if a number shows up that isn't on this list πŸ’…)

🌟 SEE ALSO 🌟


and that's a wrap, bestie 🧚 this little masterpiece is from GitHub CLI v2.102.0, dated Oct 2026, and it's giving documentation energy in the best way possible. now go forward some ports, you absolute icon πŸ‘‘πŸ’œ

πŸ“¦ where this page comes from