1、初始化本地仓库
git init
2、添加远程分支,注意添加SSH地址
git remote add origin git@gitee.com:***/***.git
3、提交修改到本地
git add .
git commit -m "首次提交"
4、把远程库中的更新合并到(pull=fetch+merge)本地库中,–-rebase的作用是取消掉本地库中刚刚的commit,并把他们接到更新后的版本库之中
详细解释看这篇:解决办法:git错误 error: failed to push some refs to 'https://github.com/…
git pull --rebase origin master
5、推送到远程分支
git push origin 本地分支:远程分支