利用git上传项目到github
(1)生成秘钥
- 先检查自己电脑有没有生成秘钥:
cd ~/.ssh
- 如果没有生成秘钥:连续3次点击回车
ssh-keygen -t rsa -C “邮箱”
- 找到公有秘钥的内容复制到github上,在github上点击settings----》点击SSH and GPG key----》点击new SSH key,然后把cat id_rsa.pub回车的公有秘钥复制到new SSH key 上:
cat id_rsa.pub
(2)上传文件到github:右键点击git bash
git config –global user.name “名字”
git config –global user.email “邮箱”
git init
git add .
git commit -m “first commit”
git remote add origin https://github.com/xxx/demo01.git
git push -u origin master