Reputation: 61
Git is for some reason not found in my VS Code running on a Windows 10 laptop. On my mac in 'User default settings' there is a Git when you scroll all the way down, but in my Windows 10 laptop it doesn't exist at all. and the Source Control shows absolutely nothing. Any idea how I can (re-)integrate Git into my VS Code?
I tried to include the following in my user settings list but it keeps telling me that "git.path" is an unknown configuration term:
"git.path" : "C:\\Program Files\\Git\\cmd"
Upvotes: 2
Views: 13682
Reputation: 61
It looks like the built-in Git extension was disabled for some reason. To activate it you have to go to Extensions and then type @builtin Git
and then enable it.
Upvotes: 4
Reputation: 72425
VSCode configuration files are encoded as JSON. JSON is a text representation of some data structure (objects in this case) and it is a subset of JavaScript. The keys of the object and the string values must be enclosed in double quotes ("
).
JavaScript (as many other languages inspired from C) use the backlash character (\
) as an escapte character in strings to encode different special characters, including the quotes (\"
) and the backslash itself (\\
).
Because Windows uses backlash as the directory delimiter in paths, all paths you put in VSCode configuration files (or in any other JSON file) must have their backslashes doubled to follow the JSON rules of writing strings.
Accordingly, your Git path configuration line should be like:
"git.path" : "C:\\Program Files\\Git\\cmd.exe"
It probably works also without the .exe
suffix (on Windows) but it's always better to use the entire name and not rely on magic to resolve incomplete file names/paths.
Upvotes: 5