1

Migrating to Visual Studio Code, I'm having trouble with the way it generates git commands from the IDE (Source Control panel, + symbol to add to the repo). Getting errors like this:

git fatal error message

> git add -A -- C:\Projects\zwm\uniq.py
fatal: C:\Projects\zwm\uniq.py: 'C:\Projects\zwm\uniq.py' is outside repository at 
'/cygdrive/c/Projects/zwm'

Obviously I'm trying to use the version of git from Cygwin. Not having a problem finding git.exe, it's in the path. Git works fine if I just add -A uniq.py from a cmd window.

Can I get VS Code to generate cygwin-style forward-slash paths? Or stop using absolute paths for files in the repo? Can't seem to find anything in the settings that addresses this.

Would this be a "terminal" issue, in that VS Code must be opening a terminal session to run git? This setting doesn't seem to make a difference: "terminal.integrated.defaultProfile.windows": "Cygwin". Nor does the setting in this promising answer: "terminal.integrated.profiles.windows": { "Cygwin": { .... I have not tried this suggestion from from github, about setting "terminal.integrated.profiles.windows": { "bash (MINGW64-MSYS2)": { ... although it seems to be talking about using the terminal with bash-style paths.

Or ... should I be using instead some other version of git built for Windows that accepts backslash-delimited paths?

Using Windows 11, VS Code 1.85.2, git 2.42.1.

UPDATE: VS Code is smart enough to update the status of a file (from U to A) if I git-add the file manually. I can see git-show commands in the output window such as git show --textconv :4x4word.py. So why is VS Code smart when issuing a git-show command, but dumb when generating git-add?

4
  • are you planning to compile under Cygwin or under Mingw ?
    – matzeri
    Commented Feb 1 at 7:49
  • @matzeri I've never done either. I do mostly Python and JavaScript development. You're think of C or C++ compilation?
    – Bob Stein
    Commented Feb 1 at 13:39
  • @matzeri ... although ... I may need Cython for a compute-bound task. Would that mean I'd need to compile and make that choice? Which do you recommend, and how would it impact my git problem?
    – Bob Stein
    Commented Feb 1 at 15:26
  • 1
    Use git built for Windows. It accepts back-slash delimited paths, forward-slash delimited paths, and even mixed-slash delimited paths, I think. Commented Feb 1 at 20:23

1 Answer 1

0

Maybe this shotgun answer to a pinpoint question may help: try running your VSCode inside the compatibility environment in which you are developing.

First, are you wedded to CygWin?

If not maybe checkout WSL or mingw?

Then you can (most likely) avoid the path problems altogether by:

Not the answer you're looking for? Browse other questions tagged or ask your own question.