首先,打开github, 创建一个仓库用来存放项目
输入Repository name(仓库名称)和Description(描述)
Public(公共):互联网上的任何人都可以看到此存储库。您选择谁可以提交。
Private(私有的):您可以选择谁可以看到并且提交到此存储库
Initialize this repository with:
Skip this step if you’re importing an existing repository.
Add a README file
This is where you can write a long description for your project. Learn more.
Add .gitignore
Choose which files not to track from a list of templates. Learn more.
Choose a license
A license tells others what they can and can't do with your code. Learn more.
这一部分是这个意思(可根据需要勾选)
最后再点击Create repository创建存储库
复制仓库链接
找到将要上传的文件目录
比如这里的project就是我要上传的文件
右键点击Git Bash Here
输入命令
git init
这条命令是初始化仓库,将这个目录变成git可以管理的仓库
git add .
这条命令是将文件添加到暂存区里面去,注意:后面有一个小**.**
git commit -m 'first project'
这条命令是将命令文件提交到仓库git commit -m '描述内容'
git remote add origin https://github.com/hanhanwanghahaha/Eating.git
关联git库,因为此时git还不知道要将我们的项目添加到哪里去,接下来就要执行命令:
git remote add origin+刚刚复制的远程仓库的地址
git pull --rebase origin master
执行上面这条命令,将文件与远程仓库进行合并
最后输入命令
git push -u origin master
这条命令是将本地文件推送到github仓库中
接下来会出现如图所示
输入你的email和密码就可以啦
现在项目已经完成上传
我们可以刷新我们的Github
如此,项目成功上传啦