Suppose you're working on WSL cli bash, then you want to use gitk
of the Windows on that current working dir, can you do this?
Regards,
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityIf you have Git for Windows installed, you can invoke gitk as gitk.exe
directly from the WSL command line without needing to install any additional software.
The only caveat to this is that the Windows version of gitk doesn't understand WSL paths, only Windows ones. This means that you can only invoke gitk.exe
from within your repository. In other words, if /mnt/c/Users/arvil/working/my-repo
is a Git repo, the following work:
$ cd /mnt/c/Users/arvil/working/my-repo && gitk.exe
$ cd /mnt/c/Users/arvil/working/my-repo/src && gitk.exe
But invoking it from outside will not:
$ gitk.exe /mnt/c/Users/arvil/working/my-repo
$ cd /mnt/c/Users/arvil/another-repo && gitk.exe ../my-repo
$ cd /mnt/c/Users/arvil/working && gitk.exe my-repo # even this fails!
Basically, if you need to pass a path to gitk, it won't work.
gitk.exe $(wslpath -w /mnt/c/Users/arvil/working)
command in WSL. For your commands, gitk.exe
should be in %PATH%
variable or one can add full path of gitk.exe
.
Nov 16, 2019 at 4:46
I came here because I wanted to do the same. Though, after I finally successfully started the gitk binary, it obviously failed to find the source code, as the Windows binary doesn't know the file locations on the WSL format. I.e. my files in WSL are on /mnt/c/git/foobar
.
You can probably make some symlinks or apply some other smart tricks to make the directory structure the same, but instead I went the other route; installing an X server on Windows and installing and elf-64 version of gitk. There are several options, but this is my working configuration:
sudo apt install gitk
echo export DISPLAY=:0 >> ~/.bashrc && source ~/.bashrc
cd /mnt/c/git/foobar && gitk --all
C:\folder\gitk.exe
convert it to/mnt/c/folder/gitk.exe
and type it in wsl.