Github has become the leading repository for open source code. The GitHub infrastructure of sharing code with other software developers is very impressive. Anybody can create their own GitHub repository. The repository does not have to be for code, it can be for word documents, excel, etc.
I will walk through creating a GitHub repository. In addition, I'll demostrate how simple it is to sync a project from Visual Studio to the GitHub repository. After the project is in a GitHub repository, any registered user on GitHub can fork your project and begin contributing to your code. As the contributing author, you would have the option to merge their code with your project.
After registering on GitHub, you will have a profile page with your GitHub username. ( CodeHeight GitHub's page) Click on the Reposities tab and the New button.
Enter a repository name and description of your project that will be uploaded to GitHub. Click Create Repository.
There are multiple way to push your code into your new GitHub repository. As for using Visual Studio, all we need it the .git URL. I have not installed the GitHub desktop application because Visual Studio works fine for my projects.
Open Visual Studio and connect to Team Explorer. If you don't see the extension, go here to install for Visual Studio. Click on Manage Connections and the Clone option and paste the .git url that GitHub assigned to your repository.
The configuration is now setup to sync to your GitHub repository. Click on Create a new project or solution.
I have created an empty solution in Visual Studio named ImageLibrary. Notice the Create new Git repository is checked.
Next, I created a Visual Studio project named ImageLibrary. It will be a empty project with ASP.NET 4.5 Framework for demonstration purposes and the file location will be in the src folder.
Within your Solution Explorer, you can view the project files. On the Team Explorer tab, you'll have the GitHub extensions displayed for sync the project to the your GitHub repository.
Click on the Changes button within your team explorer. Type in a comment and click Commit All. Next, click on the blue Sync link to upload to GitHub. Right now the project files have been committed locally on your computer.
The Outgoing Commits is ready to be pushed to GitHub. Press the blue Push link. If the code was successfully pushed to GitHub, the outgoing commits will be empty.
If you go to your GitHub profile page, your repository will have your project files.
In Summary, this was a basic introduction on how to create a GitHub repository and sync your Visual Studio with the new repository. GitHub has much more to offer and I'll expand on it some more in another blog post.