git下载地址:
https://git-for-windows.github.io/
1.git配置:
git config --global user.name “Your Name”
git config --global user.email “email@example.com”
2.查看git配置:
git config --list
3.克隆git项目:
git clone https://github.com/Xibo-Yue/okhttputils.git
4.配置ssh:
4.1查看是否已经有了ssh密钥:
cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
4.2生成ssh
ssh-keygen -t rsa -C "你上一步配置的邮箱"
按3个回车,密码为空。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………
最后得到了两个文件:id_rsa和id_rsa.pub(生成后会提示保存的路径,根据提示信息可以找到这两个路径)
如果一切顺利的话,可以在用户主目录里找到.ssh目录,里面有id_rsa和id_rsa.pub两个文件,
这两个就是SSH Key的秘钥对,id_rsa是私钥,不能泄露出去,id_rsa.pub是公钥。
4.3 github配置
登陆GitHub,打开“settings”,选择“SSH and GPG keys”
点“New SSH Key”,填上任意Title,在Key文本框里粘贴id_rsa.pub文件的内容。
添加后进行测试:
ssh git@github.com
会有如下提示:
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi Xibo-Yue! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.