gpt4 book ai didi

windows - 当我在Windows 10上的git bash中运行git-gui时,我得到 "line 3: exec: wish: not found"

转载 作者:行者123 更新时间:2023-12-03 00:56:44 29 4
gpt4 key购买 nike

我已经在Windows上使用git和git gui命令大约两年了,没有任何问题。最近,我在Windows 10上安装了ubuntu,并为linx(wsl)启用了Windows子系统,并在ubuntu bash中安装了git,以为我将从那里运行git命令。从那时起,当我将git bash用作Windows的git的一部分时,git就已经坏了。

当我在git的git bash提示符下为Windows运行git gui时,我得到了

C:/Program Files/Git/mingw64/libexec/git-core\git-gui: line 3: exec: wish: not found

关于以上输出,我发现真正令人困惑的一件事是git-gui之前的斜杠是'\'反斜杠,而其他斜杠是正斜杠,尽管这可能是无关紧要的?

我仍然可以从Windows上下文菜单中成功运行git gui(当我右键单击一个文件夹时)。

我尝试过的事情:
  • 从ubuntu上卸载了git
  • 卸载了ubuntu
  • 卸载了Windows的git,并在重启
  • 后重新安装
  • 卸载了Windows的git,从程序文件中删除了git文件夹,并在重新启动
  • 之后重新安装
  • 通过在Windows上安装tk来安装愿望https://tkdocs.com/tutorial/install.html#installwin
  • 将git重新安装到C驱动器中(避免使用“程序文件”中的空格,这可能会导致错误)。
  • 将c:\Git\mingw64\bin添加到我的用户路径变量


  • activeTCl/bin(包含wish.exe)在我的系统路径上。当我在git bash中运行“wish --version”时, pop 一个空窗口,无论它是什么,wish似乎都是可以访问的。之前从来不需要希望或ActiveTcl来运行git命令,所以我对此也有些迷惑!任何帮助,将不胜感激!如果git for Windows需要,为什么git for Windows安装程序不安装它?

    根据要求,这是我为Windows安装git时使用的选项:
  • 安装到C:/Git
  • 组件:✔️git Bash此处,✔️git Gui此处,✔️将.git *配置文件与默认文本编辑器相关联,✔️将.sh文件与Bash一起运行。
  • 使用Visual Studio Code作为Git的默认编辑器。
  • 路径:您想如何在命令行中使用Git?从命令行以及第三方软件进行Git。
  • https传输后端:使用openSSL库
  • 行尾: checkout Windows风格,提交unix风格
  • 终端仿真器:使用MinTTY
  • 额外选项:✔️启用文件系统缓存,✔️启用git凭据管理器,✔️启用符号链接(symbolic link)
  • 未选择实验性内置add -i/-p
  • 最佳答案

    我用2.24.0.windows.2版本进行了git的全新安装,并使用了与问题中提到的选项类似的选项。

    我在git-bash上运行了which命令,以获取执行git-gui的路径。

    $ which -a git-gui
    /cmd/git-gui

    使用git bash中的 /cmd检查 PATH中是否存在 echo $PATH,或者使用Windows cmd中的 C:/Git/cmd检查 PATH中是否存在 echo %PATH%。如果没有,则可以将其添加到 PATH变量(Windows cmd或git-bash)。

    如果 which命令产生多个路径,请从git bash检查 /cmd/git-gui是否执行良好,并从 git-gui变量中删除其他路径(警告!是指为 PATH找到的多个路径)。

    虽然当我假设 /cmd不在我的路径中时,我遇到相同的错误
    # Simulate an empty PATH variable
    $ export PATH=:

    # Run git-gui from git-core directory
    $ C:/Git/mingw64/libexec/git-core/git-gui
    C:/Git/mingw64/libexec/git-core/git-gui: line 3: exec: wish: not found

    git-gui存在多个路径的另一种情况:
    # Simulate PATH variable with the following directories
    $ export PATH=/usr/bin:/mingw64/libexec/git-core/:/cmd

    # Run git-gui
    $ git-gui
    /mingw64/libexec/git-core/git-gui: line 3: exec: wish: not found

    # Lists the paths
    $ which -a git-gui
    /mingw64/libexec/git-core/git-gui
    /cmd/git-gui


    注意: which命令可用于 Write the full path of COMMAND(s) to standard output.和参数 -a用于 Print all matches in PATH, not just the first
    我在Windows GitHub存储库的git上找到了一个封闭的 issue。乍一看似乎无关,但是在看到 fix的提交消息时,它为您可能会遇到错误的原因提供了一些背景信息。

    git-gui (Windows): use git-gui.exe in Create Desktop Shortcut

    When calling Repository>Create Desktop Shortcut, Git GUI assumes that it is okay to call wish.exe directly on Windows. However, in Git for Windows 2.x' context, that leaves several crucial environment variables uninitialized, resulting in a shortcut that does not work.

    To fix those environment variable woes, Git for Windows comes with a convenient git-gui.exe, so let's just use it when it is available.

    This fixes #448

    Signed-off-by: Johannes Schindelin



    如上面的提交消息中突出显示的那样,作者明确指出要使用位于 git-gui.exe目录中的 /cmd

    最后一点,我建议OP进行以下操作:
  • 分别使用PATHgit-gui命令检查Windows cmd和git-bash的where变量是否包含which的冲突目录(Windows cmd PATH env传递到git-bash)
  • 模拟一个空的PATH变量,如我上面显示的,仅将/cmd添加到git-bash的PATH变量中,然后检查是否能够从git-bash
  • 中运行 git-gui
  • 确认git-gui是否在Windows cmd中运行
  • 检查是否将目录正确添加到环境变量PATH
    (Windows cmd和git bash)
  • 尝试运行git-guigit gui,git-bash中的两个命令是否给出相同的错误?


  • I've been using git and the git gui command on windows for about 2 years with no issues. Recently, I installed ubuntu on windows 10 and enabled the windows subsystem for linx (wsl) and installed git in the ubuntu bash, thinking I'd run git command from there. Ever since, git is quite broken when I use the git bash as part of git for windows.



    为了重现这一点,我
  • 设置Windows 10 VM(内部版本1909,单一语言家庭版)
  • 为Windows版本gitt_code安装git
  • Git安装位置:2.24.0.windows.2
  • 您在问题中提到的类似选项,但编辑器除外
    观察
  • C:\Git已添加到Windows cmd的C:\Git\cmd环境变量中(因此也添加了git-bash)
  • 这两个命令PATHgit-gui都可以从git-bash
  • 中使用
  • 打开git gui的Windows功能Windows Subsystem for linux
  • 从Microsoft商店(Ubuntu 18.04)安装Ubuntu应用程序(已预安装git)
  • 使用this gitt_rli将git更新到最新版本
  • git适用于分别在Bash on Ubuntu Windows2.24.0上运行的bash和Windows
  • 这两个命令2.24.0.windows.2git gui都可以从git-bash
  • 中正常使用
  • 卸载了bash的ubuntu并关闭了wsl,它仍然可以工作


  • 进一步的 debugging可以使用git的环境 variables完成。

    GIT_EXEC_PATH determines where Git looks for its sub-programs (like git-commit, git-diff, and others). You can check the current setting by running git --exec-path.


  • 在git-bash上运行此命令git-gui,并验证是否
    显示:git --exec-path

  • GIT_TRACE controls general traces, which don’t fit into any specific category. This includes the expansion of aliases, and delegation to other sub-programs.


  • 运行此命令C:/Git/mingw64/libexec/git-core,并显示输出
    (包括GIT_TRACE=1 git gui的已解析exec目录)

  • GIT_CONFIG_NOSYSTEM, if set, disables the use of the system-wide configuration file. This is useful if your system config is interfering with your commands, but you don’t have access to change or remove it.


  • 尝试运行此命令git-gui


  • 如果没有其他作用,则可以打开一个新发行的 here

    关于windows - 当我在Windows 10上的git bash中运行git-gui时,我得到 "line 3: exec: wish: not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59002095/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com