To work on a private repo on Github with Visual Studio Code:
In Visual Studio Code: Open terminal and run: ssh-keygen
Don't enter any pass phase, just press enter (twice?)
There will be 2 new files added into "C:\Users\<YourUser>\.ssh\" folder, which are id_rsa and id_rsa.pub
Open id_rsa.pub with notepad, select all and copy.
Go to https://github.com/settings/keys and click "New SSH Key". Title can be anything to describe the PC that has the SSH key, then paste and add the SSH key.
Now, to work on the private repo on Github with Visual Studio Code, we need to do everything with SSH protocol under the user "git@git.com:<username>" instead of "https". For example:
To clone from a private repo, we need to type: git clone git@github.com:<username>/MyPrivateRepo.git
To commit and push to a branch of the private repo, we need to setup the remote origin:
Check current remote origin: git remote -v
Remove the origin: git remote remove origin
Add the new origin: git remote add origin git@github.com:<username>/MyPrivateRepo.git
Finally, commit for the first time and push: git push -u origin <branch_name>