-
You must have a Github account. If not - create one (it's free): GitHub - Sign Up
-
VSCode and Git must be installed on your Computer.
-
Install official git release: Installing Git or if you want to have GitBash: Download Git for Windows (and Git BASH)
-
Install VSCode: Download VSCode
-
Note: While doing this tutorial, if VSCode asks for sign in, then simply sign in with your GitHub account and give all permissions required.
Note: This is one time process only. Just do it once and you are good to go.
-
Open Command Prompt (cmd.exe) or GitBash
-
Set user name:
git config --global user.name "Your User Name"
-
Set user email (can be your GitHub account email or any other email address, but using your GitHub email is recommended for linking commits to your GitHub profile):
git config --global user.email "Your Email"
Now you can close the terminal.
- Open VSCode
- Select file > Open Folder
- now select your Project Folder that you want to upload.
[Note: you must have at least 1 file (even empty) in the folder or its descendants, because git did not track empty folders.
- Select Source Control Option
- Now click on Publish to GitHub
-
Select option for private or public repository
private => only you can see the repository
public => anyone can see the repository
- Now uncheck the checkbox of those file that you don't want to upload
I don't want to upload file.txt file so I am unchecking it.
- then press OK
Now it will start uploading your files to your GitHub repository.
after few second Upload will complete.
Now click on Open on GitHub to view the repository.
Now repo will be opened in your browser.
Now in your VScode you will see a new file named as .gitignore
. This file specifies which files and directories should be excluded from Git and uploading to GitHub.
I have added a new file in my repository named newProgram.c
Now click on Source control button.This will show all the changes that i have made in my repository.
Now write commit message(type anything you want) and click on commit changes(the tick option).
Click on Yes
Now click on three dot and click on push option.
Open your browser.
Referesh the page to view all new file/ changes you have made.
All new changes are updated in your repository.
If in future you want to add new commit then you can do it by repeating this step again.
[Note : new commit means new changes in your repository]
Simply delete the file in your VSCode and follow Step 4 (as this is a change).
- open your gitHub account
- Now click on Repositories
- Now click on your repository that you want to view.