Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Publishing Existing Applications to GitHub With Visual Studio 2015

DZone's Guide to

Publishing Existing Applications to GitHub With Visual Studio 2015

A brief tutorial explaining how to integrate your GitHub account with Visual Studio for easy version control.

· DevOps Zone
Free Resource

The DevOps Zone is brought to you in partnership with Sonatype Nexus. The Nexus Suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

A while ago, I published a blog post for using GitHub with Visual Studio team explorer. In reference to this blog post, one of the users emailed me asking, "how we can publish existing applications to Github?" So I thought it would be a great idea to write a blog post about it. So in this blog post, We are going to learn how we can publish existing applications to GitHub with Visual Studio 2015. Visual Studio 2015 comes with Team Explorer, and when you install Visual Studio 2015, there is an option to install the GitHub extension. If you have not installed it then you can also insert separately from the following link: https://visualstudio.github.com/

How to Publish Existing Applications to GitHub With Visual Studio 2015:

To demonstrate this we are going to use the console application. I have created a core console application with File-> New project.

Sample-Conole-Application

Once I've created the application, I have added it to the source via right clicking "solution explorer" and clicking on "Add Solution to Source Control."

add-to-source-control-github-sample-application

It will add the solution to default source control, In my Visual Studio, Git is configured as the default source control. But if it is not set, it will ask you to choose between Git or Team Foundation Server. Once you click on "Add Solution to Source Control", it will create a local Git repository. Now it’s time to write some code. Here is some sample code that I have written.

using System;
 
namespace GithubConsoleApp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.Write("Github sample application");
            Console.ReadLine();
        }
    }
}


Now it's time to commit code to a Local Git repository with Team Explorer:

commit-changes-in-git

Once you click "sync" it will try to sync with the remote Git repository since we don’t have a remote repository:

different-service-for-hosting-github-service

Here, there are three options available, Github, Team Services, or a custom remote repository. Since we are going to use GitHub, click on GetStarted for GitHub option. It will load the following screen:

github-publishing-sample-application

My GitHub account is already configured, otherwise it will ask for your GitHub Credentials.  Now click on "publish", and it will create a new repository in GitHub and publish the whole history to as well.

published-app-sample-application

You can see the same thing on github.com:

published-application-on-github

That’s it. It’s very easy to use GitHub tools with Visual Studio 2015. Hope you like it. Stay tuned for more!

You can find sample Github repository used in this application at https://github.com/dotnetjalps/GithubConsoleApp

The DevOps Zone is brought to you in partnership with Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today

Topics:
Github ,visual studio ,.net ,asp.net

Published at DZone with permission of Jalpesh Vadgama, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}