Visual Studio: How to create project from existing GitHub repository?

What I typically do in this situation;

  1. Clone repository using Git in Visual Studio; or use GitHub for Windows and Clone in Desktop from the Git project's web page. This will create a directory (repository) with the project files where you specify.

  2. In visual studio, File->New->create a new project from existing code. From the wizard, select C# or C++ (whatever your choice it does not really matter)

  3. The wizard requires a project file location: give the location of the Git folder that contains the project files (where you cloned the project's repository).

  4. The Wizard requires a unique project name, for example you can use the name of the Git project with VisualStudio (or VS) appended to the end.

  5. Git will now be in sync and you will be able to see all the git files. Making changes will check them out and allow you to push them to the project etc...

***** By default Git will want to check in the newly created .csproj file that Visual Studio creates to allow you to open the project in Visual Studio. You will just want to drag this into the excluded changes section because most likely the project in question will not be using Visual Studio.**


I solved this by opening the site as a website. File->Open->Website.

No Project Files/Solution files required. It just opens up the folder in the solution explorer.

To make it a typescript project, just add a tsconfig.json file to the directory.


Do you have any code in that repository yet that you want to open? I'm guessing not in which case you need to create a new VS project (just like you'd create a new Eclipse project and have it in your workspace)

Go to File, New..., Project... and pick the project type that you want. Give the project a name and set the location to be a folder INSIDE the folder that you cloned your Git repo to earlier (i.e. c:\mycode\mygitproject). Also give your solution a name. A "Solution" in Visual Studio is a wrapper for the projects inside it, kinda like the closest thing to a workspace or a working set in Eclipse but not quite the same thing.

Then Visual Studio should then be smart enough to pick up that this is in Git repo and allow you to commit locally as well as push/pull to GitHub etc.

Finally, while I work with the team that created the Visual Studio Tools for Git, I'd still highly recommend that you get hold of a command line should you want to do some more powerful stuff with Git other than simply committing code, push/pulling changes and branching or merging branches. If you are working against GitHub then you might also want to install GitHub for Windows which will bring some Git tools with it or you can install Git for Windows and also install Posh-Git separately. All of these things work together and give you the maximum power of Git but you can pick and choose the tool that works best for you. You'll probably find a workflow of Clone using GitHub for Windows, commit/push/pull/branch/merge in VS and then Posh-Git if you do more advanced stuff or want to hand-tweak settings.