记一次上传demo到GitHub
在github上面新建一个仓库
完成之后界面应该是这样的
- 复制仓库地址到剪贴板
- 打开项目文件夹, 右键git bash here, 初始化项目目录
$ git init
- 执行指令将文件添加到本地仓库
$ git add .
- 填写本次的提交说明
$ git commit -m "这里填写说明,记得打双引号"
- 添加远程地址,将刚才复制的地址添加进去
$ git remote add origin https://github.com/***.git
- 把远程仓库内容拉到本地
$ git pull origin master
- 推送到远程仓库
$ git push origin master
2. 如果出现一下错误
hint: Updates were rejected because the tip of your current branch is behind
- 强制更新
$ git push -u origin master -f
- 如果出现以下错误
error: src refspec master does not match any.
error: failed to push some refs to "xxxxxxx"
- 尝试
git add .
git commit -m "write your meaaage"