Skip to content

Instantly share code, notes, and snippets.

@nickbudi
Last active August 27, 2026 23:27
Show Gist options
  • Select an option

  • Save nickbudi/4b489f50086db805ea0f3864aa93a9f8 to your computer and use it in GitHub Desktop.

Select an option

Save nickbudi/4b489f50086db805ea0f3864aa93a9f8 to your computer and use it in GitHub Desktop.
Cygwin git compatibility with VS Code (or other Windows programs) using cygpath

Cygwin Git + VS Code compatibility

Thanks and credit to mattn and ferreus on GitHub.

Also check out Developing on WSL and/or wslpath (Windows 10 Build 17046 or later) if you're using the Windows Subsystem for Linux.

#!/bin/bash
# wrapper to convert linux paths to windows
# so vscode will work as a git editor with cygwin
# editor="/home/this/file.sh" in .gitconfig
# extract last argument (the file path)
for last; do true; done
# get all the initial command arguments
all="${@:1:$(($#-1))}"
# launch editor with windows path
code $all $(cygpath -w $last)
@echo off
REM wrapper to convert linux paths to windows
REM so vscode git integration will work with cygwin
REM "git.path"="C:\\this\\file.bat" in settings.json
setlocal
set PATH=C:\cygwin\bin;%PATH%
if "%1" equ "rev-parse" goto rev_parse
git %*
goto :eof
:rev_parse
for /f %%1 in ('git %*') do cygpath -w %%1
@edemaine

Copy link
Copy Markdown

For what it's worth, I tried to make a more robust shim solution for using Cygwin Git in VS Code, inspired by cyg-git. The result Cygshim should be easier to install (single prebuilt binary, then update PATH) and should handle edge cases better. In addition to Git, it provides LaTeX shims for LaTeX Workshop. If you have ideas for further improvements or extensions (e.g. other commands that need shims), let me know (on cygshim repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment