How to Use GitHub Copilot With VS Code Remote SSH Through a Bastion
🔍 WiseChecker

How to Use GitHub Copilot With VS Code Remote SSH Through a Bastion

A bastion host provides an SSH route to a private development machine. GitHub Copilot uses a separate service connection: a successful SSH session does not prove that Copilot can reach its endpoints or that the selected GitHub account has access.

Use your organization’s approved bastion configuration. You do not need to forward your SSH agent to transfer Copilot authentication tokens.

ADVERTISEMENT

1. Verify the bastion and target connection first

Ask the server administrator for the jump-host address, target-host address, login names, SSH ports and approved authentication method. Confirm the expected host-key fingerprints through a trusted channel. Do not disable host-key checking to get past a warning.

If your administrator has already supplied working SSH aliases, retain them. For a new configuration, OpenSSH’s ProxyJump lets the local client connect to a target through a jump host. This illustrative fragment belongs in the local SSH client configuration; replace all example addresses and user names, and merge it rather than replacing your existing file:

Host work-bastion
    HostName bastion.example.com
    User jump-user

Host work-dev
    HostName dev.internal.example.com
    User dev-user
    ProxyJump work-bastion

Configure each host’s approved key, port or other options separately when needed. OpenSSH documents both ProxyJump and its relationship with jump-host settings. Test ssh work-dev from the same computer that will run VS Code. Resolve SSH authentication or forwarding restrictions with the administrator before moving on.

2. Connect VS Code to the target, not just the bastion

Install the Remote – SSH extension. Run Remote-SSH: Connect to Host… and select the target alias, work-dev in the example. After connecting, check the remote indicator and terminal hostname to confirm that you opened the intended development server.

The bastion is normally a transit point, not the place to build your project or install development tools. The target must satisfy VS Code’s remote-server prerequisites and organizational installation policy. If VS Code cannot establish its server connection, inspect the Remote – SSH output; changing Copilot settings will not repair that layer. See the Remote SSH guide and remote troubleshooting reference.

ADVERTISEMENT

3. Enable Copilot with the correct VS Code account

In the connected window, inspect the GitHub Copilot extensions in Extensions. Use the installation or enable action VS Code offers for that environment; extension execution can be local or remote, so do not force a host override just because a bastion is present.

Use the Copilot status control to sign in or select Use AI Features if prompted. If multiple GitHub accounts are available, check Accounts → Manage Extension Account Preferences and the GitHub Copilot Chat account for the workspace or profile. An organization-managed user should confirm the assigned entitlement and policy. The official setup guide covers the current account flow.

Try a small chat request and an inline completion in a source file. Treat a model response as an account/service test, not proof that every repository or tool action is permitted.

4. Keep SSH agent forwarding separate from Copilot

ForwardAgent yes exposes an SSH authentication agent to the remote session. It does not transport Copilot OAuth tokens. OpenSSH disables agent forwarding by default and warns that a remote attacker with sufficient access may use the forwarded agent to authenticate elsewhere, even without extracting the private key.

A ProxyJump connection does not by itself require enabling agent forwarding. Leave it disabled unless a separate, approved workflow needs it, such as a Git operation from the target using a local SSH key. Do not copy private keys or authentication-token files onto the bastion to make Copilot work. See the ForwardAgent security warning.

ADVERTISEMENT

5. Diagnose Copilot HTTPS failures independently

If remote editing works but Copilot fails, inspect its output and search the Command Palette for Chat Diagnostics. Identify where the failing component runs before testing connectivity. A private target may have different proxy, certificate and outbound-access rules from your laptop.

GitHub provides Copilot-specific ping endpoints, including https://api.githubcopilot.com/_ping. A reachable SSH port or GitHub website is not an equivalent test. Give your administrator the failing endpoint and a redacted error, following the Copilot network guide. Do not create an unapproved internet route or disable certificate validation.

For slow responses, distinguish SSH disconnections from Copilot request delays. Extending an SSH connection timeout does not make AI generation faster, and there is no universal bandwidth threshold or two-second completion guarantee. Record a reproducible test and its logs before changing network settings.

Official documentation checked October 14, 2026.

ADVERTISEMENT

Did this guide solve your problem?