1 在项目根目录下打开Git Bash
输入命令
1.1//初始化仓库
$ git init
1.2// //添加文件到本地仓库
git add .(可指定文件name,不指定默认文件夹下全部)
1.3//添加文件描述信息
git commit -m “first commit”
1.4//链接远程仓库,创建主分支
git remote add origin + 远程仓库地址
1.5// 把本地仓库的变化连接到远程仓库主分支
git pull origin master
1.6 //把本地仓库的文件推送到远程仓库
git push -u origin master
在推送时若遇到错 请检查推送权限 或 仓库与本地仓是否同步
hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
出现以上错误 可强制更新(仅适用新建项目首次推送)
命令
$ git push -u origin master -f