公钥:
ssh key$ cd ~/.ssh , 查询是否存储公钥
ssh-keygen -t rsa -C "此处为你的邮箱"
$ ssh-keygen -t rsa -C "XXXXX.com"
创建公钥名称为user2items(可以不写)
Enter file in which to save the key (/c/Users/DELL/.ssh/id_rsa): user2items
发现有2个文件:user2items.pub 和 user2items
记事本打开user2items.pub, 复制内容到github :
点击头像进入Settings -> SSH and GPG keys -> New SSH key,将复制的信息粘贴到该处。
测试:
$ ssh -T git@github.com
Hi user2items! You've successfully authenticated, but GitHub does not provide shell access.
git init ##初始化
git add . ## 添加当前位置的全部文件, 注意 "."
git remote add origin xxx ## 添加远端仓储,origin 为远端在本地的服务主机名称,xxx 为远端url地址
git commit -m "注释语句" ## 提交到本地仓储
git push -u origin master ## 从本地上传github