programing tip

Windows에서 cygwin을 사용하여 git gui를 시작할 수 없습니다.

itbloger 2020. 11. 14. 09:57
반응형

Windows에서 cygwin을 사용하여 git gui를 시작할 수 없습니다.


문제없이 cygwin 콘솔 내에서 git gui를 시작했지만 cygwin을 업데이트 한 이후 다음과 같은 오류 메시지가 나타납니다.

$ git gui
Application initialization failed: no display name and no $DISPLAY environment variable
Error in startup script: invalid command name "tk_messageBox"
    while executing
"tk_messageBox  -icon error  -type ok  -title "git-gui: fatal error"  -message $err"
    invoked from within
"if {[catch {package require Tcl 8.4} err]
 || [catch {package require Tk  8.4} err]
} {
        catch {wm withdraw .}
        tk_messageBox \
                -icon error \
                -typ..."
    (file "/usr/lib/git-core/git-gui" line 34)

이 문제를 해결하는 방법을 아는 사람?


편집 : 이름이 변경된 패키지 등을 고려하여 2016 년 3 월에 업데이트되었습니다.

Cygwin의 gitk 및 git gui에는 X11이 필요합니다. 즉, Cygwin X11 패키지 중 일부를 설치하고 GUI를 열 수 있도록 설정해야합니다.

이것은 당신을 시작하고 실행해야합니다.

  1. Cygwin 설치 프로그램을 다시 실행합니다 ( 필요한 경우 관련 setup-*. exe를 다시 다운로드 ).
  2. 패키지 목록에서 X11 범주 아래에 "xinit"설치를 선택하십시오. 다음을 클릭하고 모든 종속성을 수락하고 설치하십시오.
  3. Windows 시작 메뉴에 새 그룹 Cygwin-X가 있어야합니다. 거기에서 XWin Server를 실행하십시오.
  4. Cygwin 셸에서 export DISPLAY=:0.0.

컴퓨터를 재부팅 할 때마다 3 단계를 반복하고 새 Cygwin 셸을 열 때마다 4 단계를 반복해야합니다 (또는 echo "export DISPLAY=:0.0" >>~/.profile새 셸을 만들 때마다 자동으로 실행되도록 실행).

댓글에 ': 0.0'을 표시하기 위해 연결할 수 없다는 오류가 표시되는 사람들이 있습니다. 이 경우 시스템 트레이에 표시되어야하는 X 위로 마우스를 가져갑니다 (X 아이콘이 숨겨져 있으면 작은 위쪽 아이콘을 클릭해야 할 수도 있습니다). 팝업 제목은 "Cygwin / X Server : 1.0"과 같이 표시되어야합니다. DISPLAY4 단계 의 값으로 ": 0.0"이 아닌 ": 1.0"(또는 표시되는 모든 항목)을 사용 하여 콜론을 포함해야합니다.

X 서버를 시작하는 데 다른 문제가있는 경우라는 파일이있을 것입니다 ~/.xsession-errors. 무엇이 잘못되었는지 그 내용을 확인하십시오. 또한 ~/.startxwinrc파일 이 있는지 확인하고 파일을 삭제하고 문제가 해결되는지 확인하십시오.

관심이있는 경우 X11 패키지가 자동으로 설치되지 않는 이유는 기술적으로 필요하지 않기 때문입니다. "xinit"패키지를 설치할 때 Cygwin이 설치하는 것과 다른 X11 서버를 사용하는 것이 다소 복잡한 방법을 통해 가능합니다.


내가 인정하는 것보다 더 많은 시간을 보낸 후, 나는 gitk내 cygwin 셸에서 실행할 작업 솔루션을 찾았습니다 . X 서버가 안정적으로 작동하도록 시작하는 방법에 대한 지침을 얻을 수 없었고 결국 솔루션은 매우 간단했습니다.

가장 큰주의 사항은 Windows 용 Git을 설치해야한다는 것입니다 . 여기 에서 다운로드 할 수 있습니다 .

이제 전체 실행 gitk부분에 대해. Windows 용 Git에는 gitk.cmdWindows 명령 파일 이있는 cmd 폴더가 포함되어 있습니다. 그게 당신이 gitk열어야 할 모든 것 입니다.

$ [path-to-git]/cmd/gitk.cmd

내 시스템에서 Git 경로는 "C : \ Program Files (x86) \ Git"에 있으므로 명령은 다음과 같습니다.

$ "/cygdrive/c/Program Files (x86)/Git/cmd/gitk.cmd"

내 ~ / .bash_profile에서 다음과 같은 호출을 처리하는 함수를 추가했습니다.

gitk() {
  "/cygdrive/c/Program Files (x86)/Git/cmd/gitk.cmd"
}

Hope this helps someone else trying to figure this piece out.


echo "export DISPLAY=:0.0" >>~/.profile

or

echo "export DISPLAY=:0.0" >>~/.bash_profile

in my case


Avoid X11 and add git gui support to cygwin

If you want to avoid X11 (and who wouldn't?):

  1. Install Git for Windows (non-cygwin) http://git-scm.com/download/win
  2. Open its command shell C:\Program Files (x86)\Git\Git Bash
  3. run git gui

(optional) If you want to stay in cygwin to launch git gui, add a function in your ~/.bashrc to do it. The only caveat is do not name the function git because of recursion and confusion with arguments, and the fact that you're Git for Windows shell may also be adding the same function when it starts. You may also run into path issues so be careful about setting up your paths correctly.

# call git gui from Git For Windows path with `ggui`
    gg() { 
    command "/cygdrive/c/Program Files (x86)/Git/bin/git" gui  2>/dev/null;


    }

When you're done editing your .bashrc, refresh your settings:

source ~./bashrc

and then simply:

gg

After following the 4 steps given by me_and and tititou36, you may still have issues of the XWin just die after you started the XwinServer.

The reason is it relies on a CygWin terminal/console, which is the host, and the Xwin dies if there is no CygWin console.

The solution for this is:

Start a Cygwin console. (you can make it automatically start by putting mintty command into the file .startxwinrc under your cygwin home directory.


Here is what worked for me:

cat >> ~/.bash_profile <<< "export DISPLAY=:0.0"

From cygwin package manager, do the following:

install xorg-server and some xorg fonts, xorg-x11-fonts-Type1 especially

Next create a link to windows font folders for git gui to use

ln -s /cygdrive/c/Windows/Fonts /usr/share/fonts/win-fonts

Close the cygwin terminal and open again then type

startxwin &> /dev/null &

git gui &


Based on AndrewD's answer: Use cygwin's git, but use Windows Git's gitk and git gui. In other words, uninstall the git-gui and gitk packages from cygwin (if installed). Then which gitk should point to the Windows file, not the cygwin binary in /usr/bin.

참고URL : https://stackoverflow.com/questions/9393462/cannot-launch-git-gui-using-cygwin-on-windows

반응형