push a local repo to github code example

Example 1: 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 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 [email protected]: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 repository to github

$ git init -b main

Example 6: how to push repository to github

$ git push origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origin