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

🌐
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.
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
Is there some permanent way to stop VSCode from asking Github username and password every time when you make a push request?
Add an ssh public key to GitHub More on reddit.com
🌐 r/vscode
9
17
November 28, 2019
Is it possible to push to github repository from vscode?
Before you can push to a remote repository, you need to tell git where that repository lives using the git remote command. If you're using GitHub or GitLab, I'm pretty sure it tells you exactly what commands to run when you create a new, empty repository. More on reddit.com
🌐 r/vscode
10
0
September 8, 2019
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
🌐
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 ... with a local folder (Option B) and want to save it to GitHub, use the Publish to GitHub button in the Source Control view....
🌐
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
🌐
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.
🌐
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 :
🌐
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.
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.
🌐
Visual Studio Code
code.visualstudio.com › docs › sourcecontrol › github
Working with GitHub in VS Code
November 3, 2021 - In VS Code, select Signing in to github.com... in the Status Bar · Paste the token and press Enter to complete the sign-in process · You can search for and clone a repository from GitHub using the Git: Clone command in the Command Palette ...
🌐
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.
🌐
DevGenius
blog.devgenius.io › how-to-add-your-project-to-github-with-visual-studio-code-b311b57ad9d0
How to Add Your Project to GitHub with Visual Studio Code | by MP Codes | Dev Genius
October 6, 2023 - In this tutorial, we’ll walk you through the process of pushing your project to GitHub using Visual Studio Code, a popular code editor. Follow these steps, and you’ll have your code safely stored on GitHub in no time. Before we begin, make sure you have the following: Visual Studio Code (VS Code): If you don’t have it installed, you can download it here. Git: Git is a version control system necessary for working with GitHub. You can download it from https://git-scm.com/.
🌐
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

🌐
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 - How to Push a Project to GitHub from VS Code (No Stress!) Push your local project to a new GitHub repository directly from VS Code ✅ Introduction Whether you’re building a side project, learning …
🌐
TutorialsPoint
tutorialspoint.com › how-to-upload-a-project-to-github-from-vs-code
How to upload a project to GitHub from VS Code?
November 1, 2023 - Creating an account on GitHub is the next step. Do it by visiting here ... 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.
🌐
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....
🌐
DEV Community
dev.to › cyberhack08 › how-to-push-your-code-from-visual-studio-local-to-github-using-git-the-terminalbeginners-2n5m
How to Push Your Code from Visual Studio (Local) to GitHub Using Git the Terminal.[Beginner's Guide] - DEV Community
November 9, 2025 - 2. To push your code to your GitHub account, use the command "git push -u origin main" You would be asked to enter your Username: Your GitHub username, and Password: That’s the token you created earlier when you created your new repository.
🌐
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 ... with a local folder (Option B) and want to save it to GitHub, use the Publish to GitHub button in the Source Control view....
🌐
GitHub
github.com › orgs › community › discussions › 108511
Pushed code changes from VSCode does not show in Github · community · Discussion #108511
And then pushed the changes to GitHub using git push git push -u origin <branch-name> (e.g., git push -u origin main or git push -u origin master) Hopefully your changes will be reflected to GitHub · Beta Was this translation helpful?