'git push Error : ![rejected] main ->main (non-fast-forward) error: falied to push some refs to http://github.com/ [duplicate]

I tried push to github and get this error : How can i fix it ? error: enter image description here



Solution 1:[1]

I think it's just because your branch on the remote repo (on GitHub) has commits that you don't have locally.

It's written in the error message (hint:)

What you should try to do is to first get what you have on otn repo with a git pull and resolve conflicts (if there are any) to then do the push.

Look at this post to understand better ;)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tykok