This is usually due to someone else or another repository pushing to the same branch, causing a conflict between your local repo and the remote repo.
Error message:
To github.com:8upersaiyan/CKmuduo.git ! [rejected] main -> main (fetch first) error: failed to push some refs to 'github.com:8upersaiyan/CKmuduo.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Solution:
git config --global pull.rebase true # Set default to rebase strategy
git pull origin main #Sync from remote to local
After solving the problem of remote synchronization to local, solve the synchronization from local to network:
use:
git add .
git commit -m "resolve conflicts and update"
git push origin main
Push local changes to the network.