1.指定用户身份
$ git config --global user.name "xuyj"
$ git config --global user.email "892575153@qq.com"
2. 添加/提交
#添加单个文件
$ git add [文件名]
#添加所有改动
$ git add -A .
#提交改动
$ git commit -m [添加说明]
3.生成 ssh key
$ ssh-keygen -t rsa -C "youremail@example.com"
4.查看ssh key
$ cat ~/.ssh/id_rsa.pub
如图:
TIM图片20190413203004.png
5.提交到GitHub
$ git push
6.第一次提交代码
# 添加身份信息
$ git config --global user.name "你的用户名"
$ git config --global user.email "你的邮箱"
# 初始化仓库
$ git init
# 添加所有变化(增、删、改)
$ git add -A .
# 提交改动
$ git commit -m "提交信息"
# 添加远程仓库
$ git remote origin "远程仓库地址"
# 上传到仓库
$ git push origin -u master