一、github网页端创建一个空项目(Repositories),并修改主分支名字为master
注意:不要勾选包含readme.md文件,保证项目是完完全全的空项目。
二、按照github将整个文件夹传上去的命令将文件夹传上去
- 打开存在的文件夹
cd 待上传的文件夹
- 初始化
git init
- 仓库关联
git remote add origin http://用户名/项目名.git
- 将该目录下的所有文件都添加到仓库
git add .
或
git add ./
- 撰写提示信息
git commit -m "初始化"
- 上传代码到仓库master主分支
git push -u origin master
三、报错解决
报错:
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <toybrick@debian.toybrick>) not allowed
或者
解决办法:
四、小贴士
- 若你的文件夹是github工程,那么需要在输入命令前,将含有.git的隐藏文件或非隐藏文件删除。