Author: M Abo Bakar Aslam

Link your Local PC Folder with a GitHub Repository and PUSH Updates using Commands

1. Install Required Tools

Make sure you have:

2. Initialize Your Local Folder

Open folder with VS Code

3. Initialize Git in your folder

Open terminal window and run below command

git init

This command will connect your folder to Git tracking.

4. Connect to GitHub Repository

Create a new repository on GitHub (empty repo) and get its link

Run below command. In this command, write link of you repo.

git remote add origin https://github.com/your-username/repo-name

5. First Time Push

Run below commads one by one. First time, you will have to run all commands.

These command will add files, commit, and push the code

git add .
git commit -m "Initial commit"
git branch -M main
git push -u origin main

Now your folder is connected to GitHub.

6. Update the Code/Files

Whenever you make changes in your code, then you will have to run below commands one by one.

git add .
git commit -m "you can write somethings here as comment"
git push -u origin main