13

I'm getting a bizarre error message while using git:

$ git clone git@github.com:Itseez/opencv.git
Cloning into 'opencv'
Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.
X11 forwarding request failed on channel 0
(...)

I was under the impression that X11 wasn't required for git, so this seemed strange. This clone worked successfully, so this is more of a "warning" issue than an "error" issue, but it seem unsettling. After all, git shouldn't need X11. Any suggestions?

7

It looks like you have ssh configured to always attempt to use X11 forwarding. The error message is GitHub telling you that you can't do X11 forwarding from their servers.

Look for ForwardX11 yes in ~/.ssh/config or /etc/ssh/ssh_config and set it to no. This will prevent ssh from attempting to use X11 forwarding for every connection.

  • 1
    You can disable FowardX11 just for github.com if you still want to use it for other servers you connect to. – Keith Thompson Jul 15 '16 at 0:04
23

Note that to disable ForwardX11 just for github.com you need something like the following in your ~/.ssh/config

Host github.com
    ForwardX11 no

Host *
    ForwardX11 yes

The last two lines assume that in general you /do/ want to forward your X connection. This can cause confusion because the following is WRONG:

ForwardX11 yes

Host github.com
    ForwardX11 no

Which is what I had (and caused me no end of confusion). This is because in .ssh/config, the first setting wins, and isn't overwritten by subsequent customizations.

HTH, Dan.

  • Many thanks for "the first setting wins"! Pulled my hair over that especially as swapping the 2 sections from your correct example also does not work! – Flamefire Aug 17 '18 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.