Here are the detailed steps needed to achieve this.

The existing commands can be simply run via the CLI terminal of VS-CODE. It is understood that Git is installed in the system, configured with desired username and email Id.

  1. Navigate to the local project directory and create a local git repository:

    git init

  2. Once that is successful, click on the 'Source Control' icon on the left navbar in VS-Code.One should be able to see files ready to be commit-ed. Press on 'Commit' button, provide comments, stage the changes and commit the files. Alternatively you can run from CLI

    git commit -am "Your comment"

  3. Now you need to visit your GitHub account and create a new Repository. Exclude creating 'README.md', '.gitIgnore' files. Also do not add any License to the repo. Sometimes these settings cause issue while pushing in.

  4. Copy the link to this newly created GitHub Repository.

  5. Come back to the terminal in VS-CODE and type these commands in succession:

    git remote add origin <Link to GitHub Repo> //maps the remote repo link to local git repo

    git remote -v //this is to verify the link to the remote repo

    git push -u origin master // pushes the commit-ed changes into the remote repo

Note: If it is the first time the local git account is trying to connect to GitHub, you may be required to enter credentials to GitHub in a separate window.

  1. You can see the success message in the Terminal. You can also verify by refreshing the GitHub repo online.
Answer from Vikram K on Stack Overflow
Top answer
1 of 16
219

Here are the detailed steps needed to achieve this.

The existing commands can be simply run via the CLI terminal of VS-CODE. It is understood that Git is installed in the system, configured with desired username and email Id.

  1. Navigate to the local project directory and create a local git repository:

    git init

  2. Once that is successful, click on the 'Source Control' icon on the left navbar in VS-Code.One should be able to see files ready to be commit-ed. Press on 'Commit' button, provide comments, stage the changes and commit the files. Alternatively you can run from CLI

    git commit -am "Your comment"

  3. Now you need to visit your GitHub account and create a new Repository. Exclude creating 'README.md', '.gitIgnore' files. Also do not add any License to the repo. Sometimes these settings cause issue while pushing in.

  4. Copy the link to this newly created GitHub Repository.

  5. Come back to the terminal in VS-CODE and type these commands in succession:

    git remote add origin <Link to GitHub Repo> //maps the remote repo link to local git repo

    git remote -v //this is to verify the link to the remote repo

    git push -u origin master // pushes the commit-ed changes into the remote repo

Note: If it is the first time the local git account is trying to connect to GitHub, you may be required to enter credentials to GitHub in a separate window.

  1. You can see the success message in the Terminal. You can also verify by refreshing the GitHub repo online.
2 of 16
66

This feature was added in 1.45, demoed here.

Launch the command palette Ctrl+Shift+P, run Publish to Github, and follow the prompt. You will be given the choice between a private and public repository, so be careful that you choose the right one.

It may ask you to login to github. It will then prompt for the repo name (defaults to the name of the folder), and for creating a .gitignore file (defaults to empty .gitignore). Just hit enter if you are fine with the defaults. When you are done it should give you a popup notification in the bottom right with a link to the repo https://github.com/<username>/<reponame>

Minor warning: if your project already has a .gitignore file in it this process will overwrite it

🌐
Graphite
graphite.com › guides › how-to-push-code-from-vscode-to-github
How to push code from VS Code to GitHub - Graphite
Learn the steps to push your code from Visual Studio Code to your GitHub repository, including setup, committing, and using both the VS Code UI and terminal.
Discussions

Using github and VS Code?
Step by step tutorials: https://vscode.github.com/ More on reddit.com
🌐 r/webdev
23
16
May 8, 2024
git - Connecting Github to VS Code on MacBook Pro - Stack Overflow
I'm want to connect my github account to vs code and have tried various things. I made sure the email I added in my terminal was the same one in my account settings. I've tried adding an ssh key (w... More on stackoverflow.com
🌐 stackoverflow.com
My code isn't pushing to GitHub from VSCode; it endlessly loads without completing the push. How do I fix?
Learn and use git CLI. These git GUI Clients are garbage and handicaps developers from actually learning real source control. More on reddit.com
🌐 r/github
21
3
August 10, 2023
How to stop the git login popup in vscode?

One way to avoid these prompts is to set up a credential helper which remembers your credentials.

More on reddit.com
🌐 r/vscode
8
13
March 9, 2018
🌐
Everhour
everhour.com › github › how to push to github: complete step-by-step guide
How to Push to GitHub from VS Code or Terminal
December 22, 2025 - Yes, use the Source Control panel or Git terminal in VSCode. Use git add, git commit, then git push to update the repo. Initialize Git in the folder and connect it to your GitHub repo.
🌐
Visual Studio Code
code.visualstudio.com › docs › sourcecontrol › quickstart
Quickstart: use source control in VS Code
November 3, 2021 - To pull or push individually, select the ellipsis menu (...) in the Source Control view and choose Pull or Push. ... If you started with a local folder (Option B) and want to save it to GitHub, use the Publish to GitHub button in the Source ...
🌐
GitHub
github.com › sailesh307 › GitHubTutorial
GitHub - sailesh307/GitHubTutorial: In this tutorial, you will get to know how to upload files or Projects step by step to GitHub using VSCode (the simplest way) · GitHub
In this tutorial, you will get to know how to upload files or Projects step by step to GitHub using VSCode (the simplest way) - sailesh307/GitHubTutorial
Starred by 65 users
Forked by 19 users
🌐
Techielass
techielass.com › how-to-push-code-from-vs-code-to-github
How to push code from VS Code to GitHub
October 23, 2025 - ... Once created, copy the repository's URL from the quick setup section. ... Switch back to your VS Code editor. Click on the ellipsis (...) in the source control view, select Pull/Push from the drop-down menu, and choose Push to.
🌐
Visual Studio Code
code.visualstudio.com › docs › sourcecontrol › github
Working with GitHub in VS Code
November 3, 2021 - Once you select Create, if you have not already pushed your branch to a GitHub remote, the extension will ask if you'd like to publish the branch and provides a dropdown to select the specific remote.
Find elsewhere
🌐
JC Chouinard
jcchouinard.com › accueil › how to commit and push code to github repository (vs code example)
How to Commit and Push Code to Github Repository (VS Code Example) - JC Chouinard
April 4, 2025 - Click on the ellipsis menu and choose “Push” to push your changes to your remote GitHub repository. That’s it! Your changes should now be visible in your GitHub repository. Although very powerful, Git is very complex.
🌐
GitHub
github.com › orgs › community › discussions › 60382
Regarding uploading the code developed on my Github repository · community · Discussion #60382
July 8, 2023 - Connect to a remote repository: In VSCode, click on the Git icon in the left sidebar to open the Source Control panel. At the top, you should see an option to publish your repository.
🌐
YouTube
youtube.com › watch
How to Upload Project to GitHub Using Visual Studio Code (2024) | Push to GitHub From VSCode - YouTube
Welcome to this quick and easy tutorial where I’ll walk you through *how to upload your project to GitHub using Visual Studio Code*. Whether you're a complet...
Published   September 30, 2024
🌐
Visual Studio Code
code.visualstudio.com › docs › sourcecontrol › overview
Source Control in VS Code
November 3, 2021 - Open a remote repository: Work with a repository without cloning it to your local machine with the GitHub Repositories extension. ... You can publish a local repository directly to GitHub with the Publish to GitHub command, which creates a new ...
🌐
Reddit
reddit.com › r/webdev › using github and vs code?
r/webdev on Reddit: Using github and VS Code?
May 8, 2024 -

Hey everyone!

I know i’m going to sound pretty stupid for this but i’ve looked all over youtube and all of the videos are from years ago or don’t really explain it well in my opinion. Can someone here explain to me in the most basic terms how to use github and vs code together so that i’m able to access my code from both my laptop and desktop

update: thank you so much everyone! i was able to figure it out

🌐
YouTube
youtube.com › watch
How to Push Code to GitHub from Visual Studio Code & Create a GitHub Repository (2024 updated) - YouTube
How to Push Code to GitHub from Visual Studio Code & Create a GitHub Repository (2024 updated)In this video, I will show you how to create a GitHub repositor...
Published   March 24, 2024
🌐
GeeksforGeeks
geeksforgeeks.org › git › gitpush-with-visual-studio-vs-code
GitPush With (Visual Studio) VS Code - GeeksforGeeks
July 23, 2025 - Step 8: These are the changes made in the local system but we want to upload the project which we created in your system to GitHub then follow the below steps to upload :
🌐
Techloy
techloy.com › how-to-push-changes-to-github-from-vs-code
How to push changes to GitHub from VS code
March 21, 2025 - First, go back to your GitHub account, open the repository, and copy the Repository URL. On your VS Code Editor, Click on the ellipsis in the source control view, select Pull/Push from the drop-down menu, and choose Push to.
🌐
Visual Studio Code
code.visualstudio.com › docs › sourcecontrol › intro-to-git
Introduction to Git in VS Code
November 3, 2021 - To pull or push individually, select the ellipsis menu (...) in the Source Control view and choose Pull or Push. ... If you started with a local folder (Option B) and want to save it to GitHub, use the Publish to GitHub button in the Source ...
🌐
Medium
medium.com › @shouke.wei › how-to-push-a-project-to-github-from-vs-code-no-stress-4aa83ce197a4
How to Push a Project to GitHub from VS Code (No Stress!) | by Dr. Shouke Wei | Medium
July 4, 2025 - ... VS Code is installed with the Git extension (usually built-in). Open your project folder in VS Code. ... Professor and Scientist in data analysis and modelling, machine learnig, and computer vision.
🌐
DEV Community
dev.to › rembertdesigns › learn-how-to-push-code-from-vscode-to-github-3klh
Learn How To Push Code From VSCode To GitHub - DEV Community
September 15, 2022 - Step 4: Click on “Create ... We will use the Github repository URL later in VSCode. Step 6: Open VSCode and open the folder which you want to push....
🌐
Medium
faizahsalami1.medium.com › a-beginners-guide-to-pushing-codes-from-vs-code-to-github-using-git-part-1-fbea7bb482f
A Beginner’s Guide to Pushing Codes from VS Code to GitHub using Git (Part 1) | by Faizah Salami | Medium
September 27, 2022 - Ensure that you have Git installed on your device. To download Git, visit Git — Downloads (git-scm.com) and select the version to download based on your operating system (macOS, Windows, Linux/Unix).