This article will demonstrate you about a open source version control and it is nothing but GitHub. We will also see what is GitHub and why should we use. This demonstration will show you how to publish your project on GitHub with Visual Studio 2015.
It is version control which provides us a centralized location where we can publish our working code or project and share it with other developers. So basically GitHub is open source version control for developers, programmers and designers so that they can publish and keep track on changes when new version release for the projects.It is free and can be download it from GitHub.
If you are a developer or programmer, on daily basis you do some codes. So, it will be a better solution for you if you store your code/project somewhere which is accessible to everyone or private. So, GitHub is there. On GitHub you can store your codes/projects and share it publicly to help other. If you have shared your project as publicly then anyone can download it and use it.
It also very helpful when you make any changes in your existing code and keep track changes on release with different versions; It works on Repository, so if you make any changes in Repository that can be tracked.
Here you can store code files, folders, images, videos and any other resource files. You can also publish a ReadMe file which stores the basic information for your project.
To access GitHub, first you need to create GitHub Account from this link. Here you can choose your display name and provide your email id for sign up.
When you sign in with your credentials then it will show you profile page on GitHub. Here you can create Repository as following.
Now it is time to create a project inside the Visual Studio and publish it in GitHub. So, I have created a dummy project only for Demo purpse in Visual Studio 2015. It is a WinForm application and nothing else.
Now right click on the solution [GitHub Demo] and it will provide a "Add Solution to Source Control" option. You need to click on this to add this project on GitHub. As I have said earlier it is nothing but only a source control to add projects.
It will provide a "Choose Source Control" popup where you can choose Git as a Source Control. Other option is for TFS. For TFS, i will be discuss in my next article. So, choose GitHub and click to OK.
NOTE: If you are not getting Git option then please Go to https://visualstudio.github.com/ and download the extension for Visual Studio.
After choosing a Git, it will add some Git related folders in your local project repository as following.
And give you few options like "Changes", "Branches", "Sync" and "Settings".
Here you need to select Changes which shows all the required changes in project. For the first time, it will show all project files as required to check in in Source Control. You need to provide description for adding the code in Source Control and hit to Commit option.
After commiting, It will commit your code in local repository as respective to your project and it will ask to you to make your project in Sync with server repository. So, just click on Sync to make these changes in server.
When you choose Sync option to make your code changes on server repository, it will ask server repository path as following image shown. So, you need to pass the server repository path here and click to publish.
If you don't have created repository on server yet. Just login with GitHub and create New Repository to click on New Repository button as following image shown.
To create New Repository, provide the repository name and description and you can also choose your repository accessiablity as Public or Private and click to New Repository button.
When new repository will done. It will be given you a repository path as following image shown in Yellow color. Just copy that path.
Just paste, that copied link inside the Publish to Remote Repository section and click to Publish button to publish repository with server Repository.
After clicking on Publish, it will be published your project in master branch. Master branch is a default branch for GitHub Source Control. You can also create new one for as your requirement.
Before publishing, this will ask to login with GitHub if you are not logged in. Just login with your user name and password.
So, finally it will add it to GitHub. Message clearly says that it has been added to Remote Repository and you will also view that to click on View link as followingg.
When you visit GitHub profile again, it will show your repository as following with name "GitHubTestDemo".
So, everything is done on GitHub. If you required any time from anywhere you can download it. If you make any changes in the project file which is added to GitHub and click to Changes.
It will show all the files, which has make any changes. You can just pass the commit message and click to Commit to upload these file into Remote Repository.
You can clearly see that all the publish files are locked [Lock sign].
So, today we have learned what is GitHub and why to use it and how to puplish your local project on GitHub from Visual Studio 2015.