Search code examples
c#asp.net-coregithubasp.net-core-webapivisual-studio-2019

How do push 2 projects in the same solution to my Github repository?


I am using visual studios 2019. I have made a solution called VitekSky. In this solution there is an MVC project called VitekSky. After I was finished with the 1st project I decided to make a 2nd project in the same solution called VitekAPI. I was able to sync my first project to github but am unable to do so with my second project called VitekAPI. The 1st project VitekSky is in asp.net core 2.2 and the 2nd project is in asp.net core 3.0.

My 2 projects in the same solution: 2 projects in same solution Unable to commit in Team explorer Unable to commit My github only contains the first project called VitekSky: https://github.com/tux-superman/VitekSky

How do I push everything I have locally onto my github repository?

EDIT: My VitekSky folder VitekSky folder

My VitekAPI folder My VitekAPI folder


Solution

  • You probably added the git repository to a project instead of to the solution. The .git folder (the local git repository) must be in the same folder as the *.sln file above all project folders. The solution folder is the parent folder of the project folders.

    I never made it, but I would suggest the following approach to fix the problem:

    • Commit all changes.
    • Close Visual Studio and any git tools.
    • Back up the solution including the local git repo (in case things go wrong).
    • Then manually move the .git folder, .gitignore, .gitattributes etc. files to the main folder.
    • Re-open Visual Studio.
    • Commit (this will result in a huge commit).

    To see the .git folder you must Show hidden files in Windows Explorer.