GitHub is one of the most popular code sharing platforms, following the GIT algorithm for version control. In this blog post, we will learn how to work with a GitHub repository and Visual Studio 2015, and will answer the following questions:
1. How to sync or share a project from Visual Studio to a GitHub Repository
2. How to clone a GitHub Repository in Visual Studio
Syncing or Sharing project from Visual Studio in GitHub Repository
To share the project, let’s take the following steps:
Step 1: Start with creating a Repository on GitHub. To do that navigate to https://github.com/ and click on the + sign to create a new repository. In this example, I am assuming that you have already created an account in GitHub.
Next you need to provide information including:
- Name of the repository
- Description of the repository
- Whether repository is public or private
- Whether to initialize the repository with a README.
Make sure not to initialize the repository with a README. If you do so, you will encounter errors while syncing the project to the repository. Once the repository is created, click on Clone or the Download dropdown and copy the web URL as shown in the image below. We’ll need the GitHub repository URL later in Visual Studio.
Step 2: Install Git for Windows on the machine. You can download this here: https://git-scm.com/download/win. After downloading, follow the screens to install completely.
Step 3: Open the Visual Studio solution you want to publish to this GitHub repository in Visual Studio. In the Visual Studio Solution Explorer, right click on the solution and click on Add Solution to Source Control.