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.
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:
- Right-click on the folder containing the working tree and .git folder.
- Click Properties
- Go to tab Security.
- Click the Advanced button.
- Click Change for the owner.
- Select your user name.
- Check Replace owner on subcontainers and objects.
- Click Apply and Ok.
Original post - https://stackoverflow.com/a/71937426/18951991