1 上传项目
- 新建github仓库
一文搞定github仓库上传维护 -
项目文件夹处打开git
鼠标右键git bash here即可。
- 初始化
$ git init
- 添加文件到仓库,.表示所有文件,也可以指定单个文件
- 上传说明,引号内容自定
- 关联远程仓库,远程仓库链接即上面创建的新仓库地址
$ git remote add origin https://github.com/xxx/xxx.git
- 上传到github
$ git push origin master:master
注:可能会报错error: failed to push some refs to ‘https://github.com/xxx’,请先运行下面命令,再重复第7步
$ git pull origin master --allow-unrelated-histories
2 更新项目
- 合并远程与本地仓库
$ git pull origin master --allow-unrelated-histories
- 添加文件到仓库,.表示所有文件,也可以指定单个文件
- 上传说明,引号内容自定
- 上传到github
$ git push origin master:master