1.在本地安装git(win10参考:https://jingyan.baidu.com/article/b24f6c821e9c8f86bfe5daa6.html)
2.打开git bash配置用户名和邮箱
git config --global user.name "yourname"
git config --global user.email "youremail"
可以使用 git config --list查看当前所有的配置
3.在github上创建自己的账号
4.创建SSH Key
a:打开Git Bash,输入pwd查看当前路径
b.输入ssh-keygen -t rsa –C “youremail@example.com”
(输入完毕后程序同时要求输入一个密语字符串(passphrase),空表示没有密语。接着会让输入2次口令(password),空表示没有口令。3次回车即可完成当前步骤)
c.在pwd刚才查看的路径下即可找到.ssh文件
d.在github上添加key(选择头像,Settings,SSH and GPG Keys,New SSH key,Title随便写,将本地生成的id_rsa.pub的内容复制到key里,Add SSH key)
git为什么生成公钥和私钥:https://www.jianshu.com/p/e93edea128a3
5.创建仓库(点击最右边的加号,选择New Repository)
填写项目名称并且选择private,(尽量不勾选Initialize...,因为第一次勾选了,结果本地的项目提交不到github上,建议将项目提交到github上之后在github上添加README.md文件)
6.在git Bash中执行如下命令
7.在git Bash中进入到本地项目的路径下(比如项目在E:\test,则cd E: ,cd test)
执行命令:
git init ------>生成本地仓库(.git文件)
git add *
git commit -m "项目第一次提交"
git push -u origin master
8.在github上查看刚刚推送的项目
9.如果想删除在github上创建的项目
a.进入自己的项目中
b.选择Settings
c.拉到最下面,点击Delete this repository,输入项目名称,点击I understand the ...,删除成功
参考文章:
https://www.jianshu.com/p/662d9bb9cadc
https://www.cnblogs.com/horanly/p/6604104.html
https://zhuanlan.zhihu.com/p/30044692
git
网盘地址:https://pan.baidu.com/s/1hDCYciNovjp2i7gchdPK2Q
提取码:2ptf