Home > OS >  GIT errors in Visual Studio 2022
GIT errors in Visual Studio 2022

Time:04-27

I have been using git in VS 2019 CE for 2yrs without any problems. I have just installed VS 2022 and git doesn't seem to work. In VS 2022 CE I loaded a uncontrolled solutions then used git to initialise and push the loaded solution. It appears to have created the repository but not pushed the files. It reports there have been errors but doesn't tell me what the errors are. The snapshot below shows the screen - nothing seems to change from first loading a newly installed VS 2022 until after clicking the 'Create Git Repository button'. Clicking 'Add to source Control' or 'Select repository' doesn't seems to change the state of the screen. I have reloaded VS and re-booted & reloaded VS without success. I have tried the solutions suggested in SO without success. one solution suggested typing 'git status' into the Package Manager Console - the PMC said git was not a known command. Screen shot of git in VS.

Do I have to load an extension to get it working?

CodePudding user response:

"git config --global --add safe.directory C:/Projects/repo1"

Not sure if same issue, but to me looks like i had the same issue with the git repo not being recognised inside Visual studio.

For me, after clearing VS cache and Clearing Temp files of user and updating git, what fixed the issue was: "git config --global --add safe.directory C:/Projects/repo1". No idea why it would be required though.

CodePudding user response:

I found solution:

  1. Right-click on the folder containing the working tree and .git folder.
  2. Click Properties
  3. Go to tab Security.
  4. Click the Advanced button.
  5. Click Change for the owner.
  6. Select your user name.
  7. Check Replace owner on subcontainers and objects.
  8. Click Apply and Ok.

Original post - https://stackoverflow.com/a/71937426/18951991

  • Related