connect git repo to github code example

Example 1: connect to github repository from terminal

to connect your repository from your terminal to your github requires you
1) Create a github repository than
2) Open Terminal
3) You will initilize git and make a branch with: git init -b main
3) Followed by the command: git add . - this adds all your edited work.
4) Followed by a Commit Command: git commit -m "this is my work" - used for 
merging
5) At the top of your GitHub repository's Quick Setup page, click  to
copy the remote repository URL.
6) In terminal add the repository URL where your local repository will be
pushed to: git remote add origin  <REMOTE_URL> - sets the new remote
7) git remote -v -Verifies the new remote URL
8) Push Changes in local Repository to GitHub: git push -u origin main -
Pushes the changes in your local repository up to the remote repository 
you specified as the origin

Example 2: upload new repo to git

echo "# Can-I-Shop-2" >> README.md
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/username/projectname.git
git push -u origin master

Example 3: pushing to github

git add .
git commit -m "First commit"
git push origin master

Example 4: how to add a repository to github

git & github