- 在你的项目根目录下打开git
2.git init
3.git add .
//添加上传的文件(所有的)
4.git commit -m "描述(比如:第一次像远程仓库提交我的代码)"
//提交上传的文件
5.git remote add origin 你的仓库地址
6.git remote set-url origin https://<你的token>@github.com/<你的名字>/<项目名>.git
//与远程的仓库建立连接
7.git push -u origin master
//把提交在本地仓库的文件上传到远程git仓库
8.如果提示:
error: failed to push some refs to 'https://github.com/zgscmt/uni-test.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git pull --rebase origin master
9.git push -u origin master