how to add git to existing project 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: git add existing project to repository

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

Example 3: git push existing code to new repository

git remote add origin <remote repository URL>

Example 4: init step way to create repository git

git configuration