Introduction
We have many ways by which we can manage Github to upload our source code. But Visual Studio provides us a simple and quick way to manage Github directly. We do not need to use any command window like Command Prompt and GitBash to manage our Github repo.
In this article, I will describe the below-mentioned points in detail.
- What is Github
- Connect Visual Studio 2022 with Github
- Create a Github Repo in Public Mode and Push Project
- Push Project Changes to Github
Prerequisites
- Visual Studio 2022 is installed on your machine.
- Basic knowledge of Github commands.
- A working project to upload.
What is Github
Github is an online software community platform to collaborate, track, and store a software project. We can upload and publish our software project on Github in both public and private modes. To read more about Github please refer to the article Git And Github Version Control.
Connect Visual Studio 2022 with Github
First, Open Visual Studio 2022 and Open Folder as shown below
Now, click on the "Add to Source Control" as shown below
Select the "Git" option and you will see the below-given window.
Now you need to fill in the following details.
- Add your Github Account
- Fill in your Github Owner username
- Give the Repository name according to your need
- Fill in the Description input
As shown in the below image.
You need to uncheck the Private repository option if you want to make your repository public and click on Create and Push. Now to confirm whether the repo is created or not go to your Github account in the browser and you will find a repo over there as given in the below image.
Push Project Changes To Github
If we made any further changes to our project we can commit and push those changes to Github from the Visual Studio itself. To check all changes you have made in the project visit the option given in the image below.
Below the Changes option, you can see that we have made changes to one Program. cs file. Now we need to do the following steps.
Add the changes to the staged area
To add all the changes in the staged area click on the plus icon as given in the below image.
Commit All the changes with a proper message
To commit all the changes, click on the option given in the below image.
Now Push all the changes in the Repository.
To push all the changes click on the option given in the below image.
Now to confirm again go to your Github account in the browser and check all the commits.
Output
In the below image you can see a commit message in the Github account.
Article in a Nutshell
- Add your Github account to the Visual Studio and give the repo name
- Click on the Create and Push.
- To push all the changes first add them to the staged area, commit them and then click on the up arrow to push them.
Conclusion
To use Github is a very simple task now. We do not need to learn all the commands like the old way. First, we need to add our Github account in the Visual Studio and then we have a create a repository with the proper name according to our needs. Now click on the Create and Push the button and Visual Studio automatically pushed all the files in the Github repository. Further, if you make any changes to the project you can easily commit and push them directly from the Visual Studio.
Thank You and Stay Tuned for More
Popular Articles About Github
More Articles from my account