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
help me set up github on vscode to push my code directly on github please.
Do you have the github plugin? That makes it easier. More on reddit.com
🌐 r/github
7
0
September 20, 2024
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 › github
Working with GitHub in VS Code
November 3, 2021 - There are many ways to interact with GitHub, for example, via their website at https://github.com or the Git command-line interface (CLI), but in VS Code, the rich GitHub integration is provided by the GitHub Pull Requests and Issues extension.
🌐
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
🌐
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

🌐
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 - Use git checkout main or the correct branch ... Initialize repo → Add remote → Add files → Commit → Push. Use git checkout -b branch-name and git push -u origin branch-name.
🌐
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.
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.
🌐
GeeksforGeeks
geeksforgeeks.org › git › gitpush-with-visual-studio-vs-code
GitPush With (Visual Studio) VS Code - GeeksforGeeks
July 23, 2025 - Step 13: Then Go to GitHub repository and refresh the page and check that our project is successfully pushed or not.
🌐
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 › 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?
🌐
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 - Whether you’re building a side project, learning Git for the first time, or just want to save your code in the cloud, uploading a project to GitHub is a crucial step. Visual Studio Code makes this easier than ever with its built-in Git integration. In this post, I’ll walk you through how to push your local project to a new GitHub repository directly from VS Code using both the terminal and the built-in UI.
🌐
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....
🌐
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 - 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. 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.
🌐
The Data School
thedataschool.co.uk › jeffrey-brian-thompson › setting-up-vs-code-and-python-with-github
Setting up VS Code and Python with GitHub - The Data School
In your VS Code terminal (with the virtual environment activated), stage your changes: git add . (This stages all new and modified files in the current directory and subdirectories.)
🌐
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.
🌐
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.
🌐
Medium
medium.com › @555mohann › how-to-push-pull-and-work-with-git-in-visual-studio-code-or-other-ides-9b0e3af68f61
How to Push, Pull and Work with Git in Visual Studio Code or Other IDE’s. | by MohanaKrishnan S | Medium
April 9, 2020 - Step 1: Login to the github.com or Sign up. Step 2: Create a new Repository. There you need to choose whether the repo must be public or private and you can initialize README.md if you needed.
🌐
Reddit
reddit.com › r/github › help me set up github on vscode to push my code directly on github please.
r/github on Reddit: help me set up github on vscode to push my code directly on github please.
September 20, 2024 -

I have installed and set up git. I do know the commands to navigate into folders, add files, commit them with a message as well. although I am able to see the commits and commit history on VSCode, I am not able to find the same repositories on my GITHUB account.

If someone can explain the whole process briefly would be really appreciated ...