5

In .ssh/config, I have set a RemoteForward for all hosts in a given domain:

Host *.[domain]
   RemoteForward [remote-port] 127.0.0.1:[local-port]

How do I unset that parameter for a specific host within that domain (e.g., git.[domain])?

2
  • The ssh_config manpage mentions the use of negation to exclude certain hosts, but only for keys in the .ssh/authorized_keys. Have tried similar combinations in .ssh/config but no dice Commented Jan 27, 2012 at 15:06
  • From the manpage I'd expect Host !git.[domain],*.[domain] to do what you want. What are the combinations you tried? Commented Jan 27, 2012 at 21:56

1 Answer 1

8

Try the ClearAllForwardings setting:

Host *.[domain]
   RemoteForward [remote-port] 127.0.0.1:[local-port]

Host git.[domain]
   ClearAllForwardings yes

Does git not automatically set ClearAllForwardings=yes, as scp and sftp do?

Sign up to request clarification or add additional context in comments.

1 Comment

It does not seem to. I had set RemoteForward 52698 127.0.0.1:52698 on top of ~/.ssh/config to use rsub on all domains, but then started getting Warning: remote port forwarding failed for listen port 52698 when connecting to GitHub (since it obviously doesn't allow forwarding a port). With ClearAllForwardings=yes under Host github.com the error went away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.