Reputation: 845
I have created a new project in Visual Studio Version 16.7.5. Then I
• Add this project to git source control
• Push the project to GitHub as a new repository
• Go to repository settings
• Add a new remote (local repository initialised with “git init --bare”)
• Try to push to the new remote -> fails with:
Microsoft.TeamFoundation.Git.Contracts.GitRemoteRefNotFoundException
I also tried pushing to the local repository first (works) and then to github (fails). I have proceded this way in over 60 projects and never had a problem so far. Also, pushing to both repositories works with projects that already exist. Does anyone have an idea how to fix this?
Upvotes: 2
Views: 6135
Reputation: 163
I fixed this by:
Reboot
Open Developer Command Prompt as admin
Execute:
devenv /resetuserdata
Load Visual Studio
Push
Upvotes: 0
Reputation: 845
Found a workaround for my problem:
git init --bare
git push [name of repo] master
Once the project has initially been pushed to the second repository like that you can use it normally in Visual Studio and push without getting the error stated in the question.
Upvotes: 1