X session in Git Bash on Windows?

I’m using Git Bash on Windows.
I have used Git Bash to SSH into a UNIX machine and tried to run a program with a GUI.
I got the message:
LINUX/UNIX system detected, but unable to access X11 display.

I have X-Win 32 (commercial). I’ve also used Xming which is like a free version of X-Win 32 but has problems with certain graphics.

  • how to roll back changes in a file in a previous commit in git
  • Is it possible to completely empty a remote Git repository?
  • can't add all files to git due to permissions
  • avoid repeat commits when cherry-pick from master to branch, then merge from branch back to master
  • GIT How to clean history pack for old deleted files?
  • How to fix corrupted git repository - “git fsck” reports “warning in tree : contains entries pointing to null sha1”
  • Is there a way I can get this remote system to access my X11 display through X-Win 32 or Xming or through any way ?

    I’d just like to run programs like MATLAB, with a GUI popping up, from UNIX machines, when SSH’ed into that machine via Git Bash on Windows.

    I also have PuTTY and Secure Shell Client installed, but would prefer to work exclusively form Git Bash because it requires less buttons to press in order to ssh to other machines.

    If it’s impossible to get this working on Git Bash I’d like to get it working with PuTTY (Secure Shell Client is good but has discontinued updates permanently).

  • Symbolic link to a hook in git
  • Override git's choice of binary file to text
  • “Git gc” complains about a bad object, but “git fsck” does not. How can I find what references this bad object?
  • Why would a user's changes be overwritten without mention of a conflict?
  • How to get the Git Commit message in Git Tower?
  • How to clean all commits from remote github repo
  • 6 Solutions collect form web for “X session in Git Bash on Windows?”

    This Q is rather old, but anyway…
    I was (at last…) able to get this working using the ssh command from Git for Windows and XMing. All I had to do was to set the DISPLAY environment variable to localhost:0.0 (it was set to only :0.0).

    An alternative to Xming is VcXsrv built using Visual Studio C++. The latest version of Xming now requires a donation.

    Point your mouse to the X icon in the status bar, and find out what port it runs on. If it is :0.0 (or :25.0), then in Git Bash: export DISPLAY=localhost:0.0 (or export DISPLAY=localhost:25.0). You may also need to use -Y instead of -X to your ssh command.

    I was able to accomplish this using putty and xming
    http://sourceforge.net/projects/xming/

    Simply start xming and enable x session forwarding in putty’s options.

    You have to start the X server before you connect using SSH. And when you connect to the other box you’ll have to include the -X switch with SSH. That’ll tell SSH to forward X11 apps output to your Windows box.

    You can try adding the -X switch to your ssh command in git bash. I’m not sure if this will work. However, it’s not the method I would suggest. Instead, I would suggest that you look into X forwarding using putty. You should be able to find a variety of guides on how to set this up with a quick search.

    Your problem is, that you somehow have to carry over the XAuthority data to the remote host. Normally SSH does this for you, but only if it’s started with the right environment variables. Basically you need to figure out the location of the xauth data and put that path into the XAUTHORITY environment variable. The DISPLAY is most likely “:0.0”.

    I think the most straightforward solution was using Cygwin and the X11 server it ships, because the X startup script of it will open a xterm from which you can SSH to the remote machine.

    Git Baby is a git and github fan, let's start git clone.