vscode: VS Code not detecting git repository after update
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.75.0
- OS Version: Windows 10 Pro (22H2)
Steps to Reproduce:
- Open VS Code workspace
- Open Source Control tab in Activity Bar
I have been using VS Code to edit this same project for four years. Just today, after updating to 1.75.0, VS Code no longer recognizes my workspace as a valid Git repository, despite it still having a .git
folder present.
I disabled all extensions and re-installed VS Code to ensure that my install was not corrupted. I also tried deleting the .git
folder in the workspace directory and re-cloning it from my origin repository. The problem persists.
Curiously, it seems to be restricted to this one workspace. I have another workspace that I have been editing with VS Code for the same duration of time and it is not affected. VS Code detects the git repository there just fine.
I am convinced it is not a problem with my Git executable or my repository, as when use git
in my terminal or install the extension GitLens (both of which utilize the same git.exe
executable as VS Code), neither has any issue interacting with the repository. Only VS Code seems to have this problem.
Here’s the output log for the Git service running on the fresh install with no extensions. It’s not very illuminating. No errors are thrown.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 12
- Comments: 37 (14 by maintainers)
Awesome! Thank you! For the time being please set the setting to always as that will restore the old behaviour. I will further investigate this later today and I will try to get a fix into recovery release that is planned for next week.
Sure I can still see the Commits and Browse them but it wont let me commit new files.
But setting
git.openRepositoryInParentFolders
= Always Fixes the problem@DiamondIceNS, @Attackly could you please share the screenshot of the “Source Control” view? VS Code
1.75
contains some changes related to git repository discovery in parent folders. Are you still able to reproduce the problem if you set thegit.openRepositoryInParentFolders
toalways
and reload the window?@kevin-guertin, thank you very much for the screenshot. I believe I have a repro 🎉 Debugging the issue now…
Thank you, the workaround provided worked perfectly for me.
Just in case it helps; I was only experiencing this issue when I use a workspace. If I open the folder instead of the workspace, it detects the repo. I suspected it might be related to doing a LiveShare- this only happened after the LiveShare ended for me.
Hope that helps, thanks again.
@lszomoru,
Thank you for fixing this.
Verification steps:
foo
andbar
and both folders containing a git repositoryfoo
workspace using the workspace file in VS Code1.75
and the “Source Control” view is emptyfoo
workspace using the workspace file in VS Code1.75.1
and the “Source Control” view should show the two git repositories@Jason3S, thank you very much for running all the tests. For the same of clarity let’s keep this issue scoped to the issue of repository discovery. That particular issue has been fix in Insiders and will be included in the Stable recovery release that is planning for later this week. I will file a separate issue to track the problem related to diff decorators.
I checked.
Apologies for the late response (looks like you’ve got this sorted, anyhow). When I opened VS Code this morning it had updated to 1.75. I don’t think I’ll revert back to 1.74.3 to do a check.
In 1.75 I no longer require the workaround, and the “Source Control” view now appears to be in the correct state, as described above. (I have not used this view on a day-to-day basis, so have nothing to compare it to in an experiential frame of ref.) In addition, when removing the workaround on 1.75, a toast (inline pop up) on the bottom right of the window renders, asking about a git repo discovered one directory above the working directory. This toast was not appearing 2 days prior.
Thanks for the fix!