git 提交项目代码到码云步骤 以及出现错误解决办法

git init
git remote add origin 项目地址
git add .
git commit -m "注释"
git push origin master

$ git push origin master
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '
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.

git pull --rebase origin master
git push origin master