push to remote git code example
Example 1: git push origin
git branch -M main
then
git push -u origin main
or
git push -f origin main
or
git push origin master --force
Example 2: git push new repo to remote
$ git remote add origin <remote repository URL>
# Sets the new remote
# Push the changes in your local repository to GitHub.
$ git push -u origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin
Example 3: git connect to remote repository
git init
git commit -m "[message]"
git remote add origin "github repository link"
git push -u origin master
Example 4: git remote push
git push <REMOTENAME> <BRANCHNAME>
Example 5: git push remote
git push -u origin master // where 'master' is branch name