- 注册GitHub 新建仓库
- 下载安装Git工具
- 右键项目,选择菜单Git Bash Here
- 执行下面代码
git init
git add .
git commit -m ‘first_commit’
#链接是你自己的项目的https链接
git remote add origin https://github.com/zhazhapan/PracticalToolBox.git
git push origin master - 可能遇到的错误
- fatal: remote origin already exists
执行:
git remote rm origin
然后再执行:git remote add origin https://github.com/zhazhapan/PracticalToolBox.git
- error:failed to push some refs to…….
执行:
git pull origin master
然后再执行:git push origin master
- fatal: refusing to merge unrelated histories
执行:
git pull origin master –allow-unrelated-histories
然后再执行:git push origin master
- fatal: remote origin already exists