gitgithubvisual-studio-code

How to add a new project to Github using VS Code


All the tutorials i've seen till now shows to first create a repository on github, copy the link go to vscode and git clone it and from that on, you can do commits and pushes.

Is that the right way ? can't I just start a project from vscode and then upload it to my git ?

EDIT 2020 :

You can now do it right inside vscode! just follow these steps:

1- Open your new project folder with vscode

2- click on the source conrol menu on the sidebar enter image description here (or press Ctrl+Shift+G)

3- Click on publish to github enter image description here

4- From there just login and follow the instructions and you're good to go.

@Debu's answer details every step, so you can jump to there


Solution

  • Well, It's quite easy.

    Open your local project.


    VSCode source control interface showing Open Folder and CLone Repository


    Add a README.md file (If you don't have anything else to add yet)


    VSCode explorer interface showing README.md


    Click on Publish on Github


    VSCode source control interface showing Initialize Repository and Clone to GitHub


    Choose whether you want your repo to be private or public


    Interface showing choice between private and public repos


    Choose the files you want to include in first commit.
    Note: If you don't select a file or folder it will added to .gitignore file


    Showing interface where you choose which files to include in the repo


    You are good to go. it is published.

    P.S. If this was your first time a prompt will ask for for your Github Credentials. Fill those in and you are good to go. It is published.