I just went the past year without using GitHub 😦 The projects I have been working on since then have relied only on TFS. This blog post is an attempt to re-remember how to publish and existing project (In my case, an ASP.NET Web App) and now that its written I wont have to re-remember it next time!
Getting Set Up
- Set up a GitHub account here.
- Download GitHub Extension for Visual Studio here.
- Connect Visual Studio to your GitHub account by clicking on the green plugin. Then selecting “Manage Connections”.
- After you’re connected, navigate back to the Team Explorer’s Home page. Select “Settings”.
- Next, enter your GitHub Username and Email. Also, set your default repository location. This is where your projects should be in order to publish them up to GitHub.
Publish a Project or Solution to GitHub
- Create any project or solution you like, or open up and existing one. Either move or save your new project to the Default Repository Location that you entered above. For this example I’m going to create a new ASP.NET Web Application and I will save it to C:\WorkSpace\GitHub
- Right click the Solution and select “Add Solution to Source Control”.
- Next, reopen Team Explorer and select “Sync”. You should see a few different option, since we are publishing to GitHub choose that option.
- Enter some comments and then click “Publish”!
- After you click “publish”, log into GitHub and you should see your project there!
Commit and Push changes
- Open up your solution and make any change you want to it or any projects within it. Save those changes > Right-Click solution > select “Commit”
You should see the changes dialog, similar to below.
If you don’t see this, then go back to the Team Explorer and click “Changes”.
- After entering some comments, select “Commit All”. You can also select “Commit All and Push”, but I’m going to split this up into two separate steps for this tutorial.
Next, let’s push this commit to our GitHub repository. To do this go to the Team Explorer and click “Sync”.
- Check it out above, its your commit! Now just click “Push” to publish it to GitHub! That’s the last step. If you go to your GitHub page you should see your commit and its comments.