Visual Studio 2022 source control not showing changes

Viewed 5081

Visual Studio 2022 not showing any change of file in git changes window, although there are some files updates are available. Whereas GIT GUI is showing all the changes in the repository.

Once I open the repository in GIT GUI all changes are also begin to display in Visual Studio git changes window.

5 Answers

visual studio 2022 shows "error parsing the git status output.". It is maybe because of mismatched versions of git or visual studio.

as a workaround, in "Package Manager Console" you can run this command:

git status

after that, visual studio shows your changes, and you can commit them!

I ran into the same issue. Then I found the answer under this video. Try this:

git config --global --add safe.directory C:/Path/To/Repo

Notice the forward slashes.

I used to connect not as admin. Then in Git Repository Settings no remotes were displayed and at Git Changes there were only "create new" options.

Then I connected as admin and remotes become available, all were working as usual. Makes no sense to me but it's "working".

TL'DR

Make sure both git and vs are up-to-date + use git status and if you got a fatal: detected dubious ownership error, then run git config --global --add safe.directory '*' and restart VS, finally, if none of these works and your local and remote copies are synced: delete the local copy and re-clone the repo again!


Possible Causes:

  1. Git, VS Versions' mismatch: I have VS2022 up-to-date, but git-bash -> git --version was 7-versions old, so I have used git-bash -> git update-git-for-windows command to have an up-to-date version of git (you can download the 'git.exe' installer as an alternative). This shows git information in vs statusbar, but some solutions still not showing the git information! if this not works for you, try the next step..

  2. In Visual Studio: View -> Other windows -> Package Manager Console, then type git status. In my case, it gives me a security fatal error!

    git : fatal: detected dubious ownership in repository at 'path-to-solution'
    At line:1 char:1
    + git status
    .
    .
    

    To overcome this, I have used the following command to get rid of this issue forever: git config --global --add safe.directory '*'

  3. If the project is relatively old, try re-cloning it again (if local and remote are synced, if not: delete the .git folder, clone the repo to a new folder, copy the .git folder from there and paste it in root folder, add and commit your changes).

Related