I have set up SSH on gitHub before and pushed it successfully once, but I got an error when I pushed it today
$ git push origin master
To git@github.com:ZhuYutao/learngit.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:ZhuYutao/learngit.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.
There is a reason in the error message.
Before you pushed this time, someone else pushed to the server. Your local is not up to date.
You need to git pull first and then push.
Upstairs is a solution, you can also force submission
It is a habit to git pull and then git push every time you commit, otherwise the above situation will occur