microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.64k stars 28.67k forks source link

Git error after updating Git to the latest available version for windows 64 #147839

Closed jlquijada closed 2 years ago

jlquijada commented 2 years ago

Issue Type: Bug

After updating Git to the latest available version for windows 64, I can use it properly on VS 2022 (preview 3), and also on VS 2019, but now it is the VS Code Insiders, the one that does not work properly. image

I used finally the workaround: git config --global --add safe.directory *

And now my user’s .gitconfig file contains:

[safe] directory = *

It was not working when I had added the different directories individually (I have more than just one git local repository). Also irrelevant in my case is the use of forward or backwards slashes in the names. I found no quotes (single or double) in the names of the directories used in the .gitconfig file. I’m the owner of all the files on those repository folders, and the Administrator on my computer. Running VS (any version) as Administrator does not make any difference to me. On VS Code I cannot select any branch, because it does not retrieve any, but shows a “master” branch as selected and all the files are marked as new (even if they are not new, nor changed). image image image

Git Graph plug-in will not retrieve any branches: image

https://developercommunity.visualstudio.com/t/Git-Error-after-1714-update/10012565#T-N10017565

VS Code version: Code - Insiders 1.67.0-insider (bd95a8d4516d590256eefecfce465a2f10e8f5e5, 2022-04-21T05:16:20.746Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz (8 x 2494)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.88GB (8.98GB free)| |Process Argv|--crash-reporter-id bc8a9eb8-5d00-452a-ae62-e2ec2c473e25| |Screen Reader|no| |VM|0%|
Extensions (55) Extension|Author (truncated)|Version ---|---|--- vscode-angular2-files|ale|1.6.4 ng-template|Ang|13.3.1 vscode-intelephense-client|bme|1.8.2 path-intellisense|chr|2.8.0 gitignore|cod|0.7.0 vscode-markdownlint|Dav|0.47.0 vscode-eslint|dba|2.2.2 xml|Dot|2.5.1 EditorConfig|Edi|0.16.4 vscode-npm-script|eg2|0.3.24 prettier-vscode|esb|9.5.0 ng-evergreen|exp|2.1.1 vscode-firefox-debug|fir|2.9.6 knockoutjs|fur|0.1.0 duplicate|gee|1.0.2 copilot|Git|1.12.5517 gc-excelviewer|Gra|4.2.54 todo-tree|Gru|0.0.215 beautify|Hoo|1.5.0 rest-client|hum|0.24.6 vscode-edit-csv|jan|0.6.8 vscode-todo-highlight|jgc|2.0.4 Angular2|joh|13.0.0 i18n-ally|lok|2.8.1 rainbow-csv|mec|2.2.0 git-graph|mhu|1.30.0 Angular-BeastCode|Mik|10.0.3 vscode-scss|mrm|0.10.0 notepadplusplus-keybindings|ms-|1.0.7 vscode-typescript-tslint-plugin|ms-|1.3.4 debugger-for-edge|msj|1.0.15 abracadabra|nic|6.12.0 indent-rainbow|ode|8.3.1 vscode-versionlens|pfl|1.0.9 vscode-css-peek|pra|4.2.0 swagger-php-annotation|qvt|1.1.1 vscode-flexbox-picker|Rax|0.0.1 vscode-sort-json|ric|1.20.0 format-html-in-php|rif|1.7.0 live-sass|rit|3.0.0 LiveServer|rit|5.7.5 color-manager|roy|0.6.3 vscode-javascript-booster|sbu|14.0.1 vscode-cy-helper|She|1.2.2 vscode-cy-helper|she|2.4.0 vscode-scss-formatter|sib|2.4.2 html5-boilerplate|sid|1.1.1 vscode-stylelint|sty|1.2.2 sass-indented|syl|1.8.19 tabnine-vscode|Tab|3.5.42 poor-mans-t-sql-formatter-vscode|Tao|1.6.10 vscodeintellicode|Vis|1.2.19 vscode-todo-highlight|way|1.0.5 php-debug|xde|1.26.0 markdown-all-in-one|yzh|3.4.2
A/B Experiments ``` vsliv695:30137379 vsins829:30139715 vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyl392:30422396 pythontb:30258533 vsc_aa:30263845 pythonptprofiler:30281269 vshan820:30294714 pythondataviewer:30285072 vscod805:30301674 pythonvspyt200:30323110 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30404738 wslgetstarted:30449409 pythonvspyt640:30438691 vscscmwlcmt:30465136 cppdebug:30475216 vscaat:30438846 pynewfile477:30451556 ```
jlquijada commented 2 years ago

I have made some more tests.

Git GUI (and Git Cmd) and the Fork application, don't have any trouble, and the safe directory configurations make no difference whatsoever.

On my user's .gitconfig file I have removed the * from the list of safe directories (in the snippet below it is just commented), and placed an entry for every Git project that I have locally on my computer.

[safe] ; directory = * directory = C:/GitProjects/Project-1 directory = C:/GitProjects/Project-1/Project-1/ClientApp directory = C:/GitProjects/Project-2 directory = C:/GitProjects/Project-3 directory = C:/GitProjects/Project-4

I'm the only user on this computer (Windows 10), and I'm the Administrator for the machine. I'm the owner of all folders under and including C:/GitProjects

With this configuration I can handle all my projects from VS2022 Preview 5.0 from within VS.

The Project-1 directory contains both the back-end sources (.Net Core 5.0, for the moment, with SPA activated to serve the front-end), and the front-end sources (Angular 13, for the moment). All is built using the same CI Agent to build a single package.

The .git directory is placed on the main project directory as always: C:/GitProjects/Project-1

I have had to add the directory where the Angular project lies to the safe list: C:/GitProjects/Project-1/Project-1/ClientApp in order for VS Code to be able to detect the Git SCM, but then the same problem arises: All the files in the directory and subdirectories are marked as Untracked (only in VS Code).

Previously VS Code had no problem finding the .git folder inside C:/GitProjects/Project-1 while having the C:/GitProjects/Project-1/Project-1/ClientApp folder loaded, and I could see the local changes, and diff files correctly.

jlquijada commented 2 years ago

The repository is in Azure DevOps

The local branches are not retrieved, either by VS Code Git extension, neither by Git Graph extensions: image

All the files are marked as untracked: image

jlquijada commented 2 years ago

I see now that the problem might lie in Git itself behaving differently, will try to report the problem there.

This is the output I get on my command line just using Git

C:\GitProjects\Project-1>git status

On branch master Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

C:\GitProjects\Project-1>cd Project-1

C:\GitProjects\Project-1\Project-1>git status

On branch master Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

C:\GitProjects\Project-1\Project-1>cd ClientApp

C:\GitProjects\Project-1\Project-1\ClientApp>git status

On branch master

No commits yet

Untracked files: (use "git add ..." to include in what will be committed) .angulardoc.json .browserslistrc .editorconfig .eslintrc.json .gitignore .vscode/ README.md angular.json karma.conf.js package-lock.json package.json src/ tsconfig.app.json tsconfig.json tsconfig.spec.json

nothing added to commit but untracked files present (use "git add" to track)

The result of the last git status command is incorrect, and before it was returning the same result as in the other directories inside the local repository (the previous git status commands on this extract).

jlquijada commented 2 years ago

Mistery solved!

Somehow a new .git directory had been created on C:\GitProjects\Project-1\Project-1\ClientApp and was making a mess of things. Probably it was one of those times before adding all the directories to the [safe] list, that VS Code was not able to find the repository and was prompting me to either commit to GitHub or start a new Git repository.

After removing it, now the correct repository is "seen" by Git and VS Code.

Also removed the C:\GitProjects\Project-1\Project-1\ClientApp from the list of safe directories.