以码云为例
- 在码云新建一个仓库
- 在本地项目的根目录,使用 git 初始化仓库
git init
- 将本地仓库与远程仓库相关联
git remote add origin https://gitee.com/xxx/renren-fast-vue.git
4. 将远程仓库 pull 到本地
git pull origin master --allow-unrelated-histories
--allow-unrelated-histories
允许合并没有共同历史的两个分支
- 将本地代码 push 到远程仓库
git add -A git commit -m "msg"
git push -u origin master
-u
只需要第一次加,作用是将本地仓库与远程仓库相关联起来
Reference