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 ?


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.