There is two scenario
We have repository which contains files and folders and now create our own files and folders and push into repo.
We use the following command.
git add . (. for all files and folder) or git add < file name >
git commit -m "message"
git push ( enter username and password(token))
for first time when repo is empty
git init
git add . or git add < file name >
git commit -m "message"
git branch -M main
git remote add origin < repo http url >
git push -u origin main
once it's successfully pushed after that we can create branch and commit our latest code
git add . or git add < file name >
git commit -m "message"
git push