Se outra pessoa tiver feito push no mesmo branch que você, o Git não poderá fazer push das alterações:
$ git push origin main > To https://hostname/USERNAME/REPOSITORY.git > ! [rejected] main -> main (non-fast-forward) > error: failed to push some refs to 'https://hostname/USERNAME/REPOSITORY.git' > To prevent you from losing history, non-fast-forward updates were rejected > Merge the remote changes (e.g. 'git pull') before pushing again. See the > 'Note about fast-forwards' section of 'git push --help' for details. Você pode corrigir isso fazendo fetch e merge das alterações feitas no branch remote com as alterações que foram feitas localmente:
$ git fetch origin # Faz fetch das atualizações feitas em um repositório online $ git merge origin YOUR_BRANCH_NAME # Faz merge de atualizações feitas online com seu trabalho local Ou você pode simplesmente usar git pull para executar ambos os comandos de uma vez:
$ git pull origin YOUR_BRANCH_NAME # Captura atualizações online e faz merge delas com seu trabalho local