在 Github 上新建新项目
- 打开 Github, 点击 Repositories,点击 New
- 输入 Repository name,点击 Create repository
- 项目新建成功,点击 Code,复制仓库地址
- 命令行输入 git clone 仓库地址 或 Git 客户端打开刚才复制的地址
旧项目推到 Github 上
- 在 Github 上新建一个仓库,参考上面的步骤
- 提交内容到暂存区
git add .
- 添加注释
git commit -m "Initial commit"
- 添加远程仓库地址
git remote add origin + 你的仓库地址
- 拉取远程仓库代码,新项目一般没有冲突,有冲突的话要先解决冲突,然后重新 add 和 commit
git pull –rebase origin master
- 提交到远程仓库
git push -u origin master