pushing repository to github code example

Example 1: git add existing project to repository

git remote add origin <repository url>
git branch -M main
git push -u origin main

Example 2: create new repository on the command line

git init
git add README.MD
git commit -m "commit message"
git remote add origin git url_of_github_repo
git push origin master

Example 3: initialize a repo and push to github

git init
git add -A
git commit -m 'Added my project'
git remote add origin git@github.com:sammy/my-new-project.git
git push -u -f origin master

Example 4: pushing to github

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

Example 5: how to push to git hub

git push  <REMOTENAME> <BRANCHNAME>