ssh jump host fails on Windows because nc is not installed
/usr/bin/bash: line 0: exec: nc: not foundShort answer
ProxyCommand runs the command you wrote through your shell, so nc has to exist on that machine. Git for Windows does not ship it. Replace the nc line with ProxyJump, or with ProxyCommand ssh -W %h:%p jumphost. Both let the OpenSSH client open the tunnel by itself, so no netcat is needed.
Fix it fast
1Find out which cause you have
Print the ProxyCommand ssh really uses for the host. It shows which helper program the config asks for.
ssh -G target | grep -i -E "^(proxycommand|proxyjump)"2Match what you see, then jump to its fix
- 1
exec: nc: not foundThe config calls nc, which is not installedFix - 2
an older config or tutorial line such as ProxyCommand nc %h %pYou need ProxyCommand (for example to pass extra options) but want no netcatFix - 3
ProxyJump seems ignored and the nc error remainsBoth ProxyCommand and ProxyJump are set, and the first one winsFix
- 1
What does the error look like?
/usr/bin/bash: line 0: exec: nc: not found
Cause 1 of 3
The config calls nc, which is not installed
1Check
ProxyCommand is run with the shell's exec directive, so the program in it must be found on PATH. Ask the shell whether nc exists.
command -v nc || echo "nc is missing"
grep -n -i "ProxyCommand" ~/.ssh/config2Fix
Stop depending on nc. Describe the jump host with ProxyJump; ssh then opens the hop itself.
# ~/.ssh/config
Host target
HostName 10.0.0.20
User deploy
ProxyJump jumpuser@jump.example.com3Verify
Connect to the target; ssh should ask for the target's login, not print the nc error.
ssh -v targetConfirmed by man.openbsd.org
Cause 2 of 3
You need ProxyCommand (for example to pass extra options) but want no netcat
1Check
ProxyCommand and ProxyJump both accept the %h and %p tokens. ssh itself can forward standard input and output to a host and port with -W, so a second ssh can replace nc.
grep -n "%h" ~/.ssh/config2Fix
Point ProxyCommand at ssh -W instead of nc.
# ~/.ssh/config
Host target
HostName 10.0.0.20
ProxyCommand ssh -W %h:%p jumpuser@jump.example.com3Verify
Run a command through the tunnel.
ssh target hostnameConfirmed by man.openbsd.org
Cause 3 of 3
Both ProxyCommand and ProxyJump are set, and the first one wins
1Check
ssh_config says the two options conflict and the one specified first takes effect, so an old ProxyCommand earlier in the file (or under Host *) hides your new ProxyJump.
ssh -G target | grep -i -E "^(proxycommand|proxyjump)"2Fix
Delete the old ProxyCommand line, or set ProxyCommand none for this host before the ProxyJump line.
Host target
ProxyCommand none
ProxyJump jumpuser@jump.example.com3Verify
The effective config should now list only the jump.
ssh -G target | grep -i proxyConfirmed by man.openbsd.org
How do I stop it coming back?
- Prefer ProxyJump (or ssh -J) for plain SSH hops; keep ProxyCommand for real proxies.
- Keep jump host settings such as user and key in ~/.ssh/config, as the OpenSSH manual advises.
- Use ssh -G host to see the final merged config before debugging connections.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Security
Entra ID token request fails: the request body must contain the parameter 'grant_type'
AADSTS900144: The request body must contain the following parameter: 'grant_type'.
The token endpoint did not find grant_type in the form body of your POST.
3 causes, each with a fixSecurity
Angular HttpClient does not add the X-XSRF-TOKEN header to a request
403 Forbidden on POST, PUT or DELETE while GET works
Angular copies the XSRF-TOKEN cookie into an X-XSRF-TOKEN header only for mutating requests to the same origin, and only when the cookie is readable by script.
5 causes, each with a fixSecurity
An [Authorize] endpoint rejects a request with a bearer token
Authorization Header sent: no Bearer token sent.
An [Authorize] endpoint without a policy name requires an authenticated user.
4 causes, each with a fixSecurity
ASP.NET Core API rejects an Angular user's token: the signature key was not found
401 Unauthorized
The API looked for the key named by the token's kid in the key set it downloaded from your Authority, and the key was not there.
4 causes, each with a fixSecurity
ASP.NET Core rejects the token before checking it: IDX12741, three segments expected
401 Unauthorized
IDX12741 means the string the API pulled out of the Authorization header is not shaped like a JWT: a signed token has three dot-separated parts and an encrypted one has five.
3 causes, each with a fixSecurity
A Microsoft Entra access token shows Invalid Signature when you check it yourself
Tokens that a Microsoft API receives might not always be a JWT that can be decoded
A token issued for Microsoft Graph is not meant for you to validate, so a failed signature check is expected.
2 causes, each with a fix