1、注册登录GitHub账号
2、点击右上角头像,点击 Your profile
3、如下图所示
4、输入 repository name,选择public ,点击create repository按钮
5、创建成功:
6、Github上传项目的方法,有两种方法:一种通过https,一种通过ssh。本人默认选择https,当然ssh可以自行尝试
7、打开终端,在终端进入要传文件的根目录 。下面继续在终端执行操作
8、输入 git init
9、输入git add . (注意最后面的点)
10、输入 git commit -m “信息说明” (git commit -m “信息说明”)
11、git remote add origin https的地址
12、git push -u origin master
13、刷新GitHub界面即可看到上传的信息
git 添加远程github仓库的时候提示错误:fatal: remote origin already exists.
解决办法:输入 git remote rm origin 在执行上面的11步骤
注意cd 进入的文件是要上传内容的直接上一级目录