简体   繁体   中英

Add solution to source control does nothing for Git in VS 2017

I can add to source control if I go to tools > options > plug-ins and change it to subversion from git, but I want to add the project to bitbucket. If I keep it on git and right click the project and click Add Solution to Source Control, nothing happens at all. I only saw one posting about this issue here Add Solution to Source Control: Nothing happens and I tried clearing out the cache in C:\\Users\\Andy\\AppData\\Local\\Microsoft\\Team Foundation\\6.0\\Cache , but same issue. I'm currently developing a MVC5 Web Application using visual studio 2017 community. Any help is appreciated.

Actually, as long as you have "Git" selected as your Source Control provider, selecting "Add Solution to Source Control" should be creating a local Git repo (check the solution root folder for .git folder). The only thing you might notice in the UI is the Git status icons appearing in the lower right corner.

You then can add a remote connection to Bitbucket via Team Explorer -> Repository Settings -> Remotes -> Add. Personally, I like to use SourceTree for handling a lot of the Git configuration details rather than Visual Studio.

If you go to the Git Global Config in the Team Explorer and you get errors about the /config and all the settings are blank; You'll need to set a HOME environmental variable in Windows. Don't do what I did and set it at the command prompt and then spend several hours trying to figure out why it still doesn't work. CLose VS, set the Environmental Variable HOME to %userprofile% (or where ever the global .gitconfig file is located if you moved it) Re-launch VS. If you had lost your repo's they should be back, and you should now be able to add new repos.

I had this issue recently as well. None of the suggestions I found on SO or Google provided any results until I noticed a "documents" repo listed in the Team Explorer and realized I had somehow accidentally turned my entire Documents folder into a Git repo. I deleted the .git directory from my Documents folder and now it works fine. So, if all else fails, start looking up the folder hierarchy for a .git directory.

I had the same issue, in my case saving the solution then closing and re-opening Visual Studio solved the issue. No idea why this worked though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM