Git mergetool meld on windows using putty

为君一笑 提交于 2019-12-22 12:57:22

问题


I have used meld to merge the conflicted files in git for a long time while running on Ubuntu. Now I need to merge files, but my environnement has changed. I now use a PC on Windows 7, and connects to a CentOS server using Putty. I installed meld on the server :

Package meld-1.3.1-2.el6.noarch already installed and latest version

I tried even to install meld for windows on my PC... it doesn't help. When running :

git mergetool -t meld

Here's the response :

Merging the files: gagglon/v4/www/includes/php/test.php
Normal merge conflict for 'gagglon/v4/www/includes/php/test.php':
{local}: modified
{remote}: modified
Hit return to start merge resolution tool (meld):
Traceback (most recent call last):
File "/usr/bin/meld", line 61, in <module>
import gtk
File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module>
_init()
File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init
_gtk.init_check()
RuntimeError: could not open display
gagglon/v4/www/includes/php/test.php seems unchanged.
Was the merge successful? [y/n] n
merge of gagglon/v4/www/includes/php/test.php failed

What can I do to get meld back, or could you help me find another tool I could use that would be also easy to use like meld ? Any easy interface would do...

Thanks ahead !


回答1:


On CentOS, most of the threads I found insist on the importance of setting properly the environment variable $DISPLAY.

Noticed that there DISPLAY environment variable was gone in that terminal session.
Opening new terminal session or use different terminal session solves the problem...

export DISPLAY=":1.0"

But on putty, is is harder, as explained in this thread:

All the system-config commands are designed to be ran via X11 (a Linux GUI).
From the error messages its trying to run gtk commands which means its trying to open a GUI window, which is not going to happen via putty.
I would look for other commands to setup what your trying to do.

Why wouldn't you use meld on Windows directly?

With putty only, you can try this solution, based on X11 forwarding:

That means:

  • installing an X11 server on Windows, like XMing,
  • don't forget the fonts: yum install xorg-x11-font*.


来源:https://stackoverflow.com/questions/19346446/git-mergetool-meld-on-windows-using-putty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!