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.
When I run git gui in the git bash prompt in git for windows I get
C:/Program Files/Git/mingw64/libexec/git-core\git-gui: line 3: exec: wish: not found
One thing I find really mystifying about the above output is that the slash before git-gui is a '\' backslash while the others are forward slashes, though it's probably irrelevent?
I can still successfully run git gui from the windows context menu (when I right click a folder).
Things I've tried:
activeTCl/bin (which contains the wish.exe) is on my system path. When I run 'wish --version' in git bash a little empty window pops up, wish seems accessible, whatever it is. Never needed wish or ActiveTcl to run git commands before, so I'm a bit mystified by that as well! Anyhelp would be appreciated! If wish is needed by git for windows why isn't it installed by the git for windows installer?
As requested, Here's the options I used when installing git for windows:
I did a fresh installation of git with version 2.24.0.windows.2 with similar options as mentioned in the question.
I ran the which command on git-bash to get the path from where git-gui is being executed.
$ which -a git-gui
/cmd/git-gui
Check if /cmd is there in your PATH using echo $PATH in git bash or check if C:/Git/cmd is there in your PATH using echo %PATH% in Windows cmd. If not, then you can add it to your PATH variable (either Windows cmd or git-bash).
If the which command yields multiple paths, check if /cmd/git-gui executes well from git bash and remove the other paths(caution! refers to multiple paths found for git-gui) from the PATH variable.
I get the same error though when I assume that /cmd is not in my path
# 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
Another case where multiple paths exist for 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
Note:
which command can be used to Write the full path of COMMAND(s) to standard output. and the argument
-a is used to Print all matches in PATH, not just the first
I found a closed issue on git for Windows GitHub repository. Seems unrelated at first sight, however on seeing the commit message of the fix it provides some background on why you might be facing the error.
git-gui (Windows): use git-gui.exe in
Create Desktop ShortcutWhen calling
Repository>Create Desktop Shortcut, Git GUI assumes that it is okay to callwish.exedirectly 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
As highlighted in the commit message above, the author clearly points out to use git-gui.exe located in the /cmd directory.
As a final note, I would suggest OP to :
PATH variable of Windows cmd and git-bash for conflicting directories containing git-gui using where and which commands respectively (Windows cmd PATH env is passed on to git-bash) PATH variable as I have shown above and add only /cmd to the PATH variable of git-bash and then check if you are able to run git-gui from git-bashgit-gui runs in Windows cmdPATH correctly
(Windows cmd and git bash)git-gui and git gui, do both the commands in git-bash give the same error ?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.
To reproduce this, I
Install git for windows version 2.24.0.windows.2
C:\Git
C:\Git\cmd is added to the PATH environment variable of Windows cmd (and therefore git-bash too)git-gui and git gui work from git-bashTurn on Windows feature Windows Subsystem for linux for Bash on Ubuntu Windows
2.24.0 and 2.24.0.windows.2 respectivelygit gui and git-gui work as expected from git-bashFurther debugging can be done using git's environment variables.
GIT_EXEC_PATHdetermines 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 --exec-path on git-bash, and verify if it
shows : C:/Git/mingw64/libexec/git-core
GIT_TRACEcontrols general traces, which don’t fit into any specific category. This includes the expansion of aliases, and delegation to other sub-programs.
GIT_TRACE=1 git gui, and show the output
(which includes the resolved exec directory for git-gui)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_CONFIG_NOSYSTEM=1 git gui
You can open a new issue here, if nothing else works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With