How to upload a project to GitHub from VS Code?


Introduction

When editing code, reviewing changes, and submitting to GitHub, developers often switch between multiple windows. In order for different modules and versions to be operated by different teams, version control is indispensable for every software project.

This blog will explain how to publish your Visual Studio Code code to Github. Let's take a look at GitHub and Visual Studio in brief before you start working with them.

What is GitHub?

A big part of the popularity of GitHub is because of the large developer community that it has. It is a platform that fosters collaboration between developers and facilitates communication and collaboration between them as well. Along with a number of useful features that are offered by GitHub, it also provides a host of other features that facilitate collaboration between development teams on projects in a way that is very comfortable for them to use. GitHub not only makes it very easy to create new versions of information without disrupting the current versions of the software, but it also offers a wide range of other features that enable collaboration between development teams.

A new addition to a program can be easily incorporated into an existing program after it has been completed, for example. It is also incredibly simple to collaborate on GitHub on strings of code, so even the smallest parts of a program can be perfected. The GitHub platform makes it easy to collaborate and work on projects with others from anywhere in the world.

What is VS Code?

Visual Studio Code (VSCode) is one of the most popular Code Editors/IDEs of today due to its simple and elegant design as well as its powerful features and performance. With free, open-source software, you can debug, use Git version control, highlight syntax, and add snippets to your code. VSCode is a developer-focused editor written in Ruby on Rails, built using Github's Electron Framework, and with a wealth of extensions to assist you in almost any area of development. VSCode offers a highly customizable user interface, allowing users to choose from a variety of theme options, keyboard shortcuts, and settings.

How to push code from Vs Code to GitHub?

Step 1 − Download and install Git

Git must first be installed on your computer before you can use it. GitHub uses Git as its underlying technology. You can find the right download for your operating system here. It should be installed using the default settings.

Step 2 − Sign up for a GitHub account.

Creating an account on GitHub is the next step. Do it by visiting here

Step 3 − Set up a New GitHub repository

1. As a first step to create a repository you need to log in to your GitHub account.

2. Start a new repository by clicking the + icon in the top right corner.

3. Create a repository by entering a name and clicking the Create repository button.

4. Copy the URL of your repository once it has been created. With this URL, we can push code to this repository from Visual Studio Code.

Step 4 − Open the folder you wish to push in Visual Studio code. Once you have clicked on "Source Control", click on "Initialize Repository."

Step 6 − Click on "Yes" after writing a commit message, press the "Ctrl + Enter" key, and the commit will begin.

Step 7 − Within the Source Control panel, click the Overflow button (with the ellipsis). Then, select Push from the Pull, Push menu option.

Step 8 − The remote will need to be added. Add a remote by clicking the Add Remote button.

Step 9 − This will open a new window. Copy the URL of your GitHub repository from GitHub and paste it here.

Step 10 − Press Enter after typing any remote name.

Step 11 − Open the Push to sub-menu option again. Then, choose your repository path and press Enter.

Step 12 − Logging into GitHub will appear as a pop-up. Please choose which option you will use to sign. The browser will display an authorization page. Authorize GitCredentialManager by clicking the button. Please enter your GitHub password now

Step 13 − Last but not least, refresh the URL of your GitHub repository.

Visual Studio Code has successfully delivered the code to GitHub. In the repository, you can see all the data, so you can verify whether the project was successfully transferred.

Conclusion

If you're just getting started with VSCode or want to take a closer look before diving in, this article will provide you with valuable insight into how to integrate your visual studio code with GitHub, improving your productivity and work performance.

Updated on: 01-Nov-2023

45K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements