一、配置用户名和密码
- 配置用户名
git config --global user.name "注册的用户名"
- 配置邮箱
git config --global user.email "注册的邮箱@qq.com"
- 生成公钥和私钥、按3次 Enter
ssh-keygen -t rsa -C "注册的邮箱@qq.com"
- C:\Users\Administrator 目录下面找到 .ssh文件
id_rsa 文件为私钥
id_rsa.pub 文件为公钥
- github上 绑定你的 公钥
二、上传项目
首先 需要 在github 上创建一个 仓库 用于存放项目
注意:空目录不会上传,如果想上传一个空目录、使用 touch xxx.md 创建文档,在提交一次就可以上传成功。
touch README.md
1. git init 初始化
3. git add . 添加到缓存区
3. git commit -m "提交说明" 注释
4. git remote add origin 远程仓库地址 关联连远程仓库
5. git push -u origin master 推送本地库内容到远程库