Hello. I have the following situation when adding files to git. With git add, everything is fine as usual, with git commit, too, and when I write a git push origin master, this error appears:

*To git@github.com:triodjangopiter/junior.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:triodjangopiter/junior.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (eg hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.* 

Help me please. Thank.

  • Are you trying to push into your repository? - Nick Volynkin
  • one
    it looks like you have changes there that are not yet local. See what git log --oneline --graph --decorate --all - Nick Volynkin
  • git log --oneline --graph --decorate --all he told me here that rolled out sheets for 10 - Pavel
  • Yes, I push into my repository. - Pavel
  • But what to do is not clear yet ((( - Pavel

2 answers 2

Solved a problem with the team:

 git branch --set-upstream-to=origin/master 

Thanks to all.

  • And what did you do in what branch? - Nick Volynkin
  • And I have only one. Others are not just starting. - Pavel
  • The problem was that the local and remote master diverged by some commits. So for sure you first made git pull and pulled up the changes. - Nick Volynkin

First do: git pull origin master Then: git push origin master

  • You should not just do git pull , because there will be an extra merg to his master, and then this merg will start back up. - Nick Volynkin
  • And what else is going to happen? - Pavel