git生成秘钥,详细步骤,亲测有效

首先下载安装git:https://git-scm.com/downloads/

一路默认,安装完成后,打开文件夹C:\Users\Administrator\.ssh(Administrator是当前用户名),在空白处点鼠标右键选择“Git Bush Here” ,打开gitbush。

配置用户名和邮箱:(注意修改为自己的用户名、邮箱)

$ git config --global user.name "your_name"

$ git config --global user.email "[email protected]"

生成密钥对:

ssh-keygen -t rsa -C "[email protected]"

此时文件夹中会生成两个密钥文件:

打开id_rsa.pub,将文件内容全选复制,准备粘贴到github上:

登陆github,点击右上角头像,选择Settings,选择SSH and GPG keys:

点击“New SSH key”,将复制的密钥内容粘贴进Key的输入框,Title随便取:

回到gitbush,测试输入: ssh -T [email protected]

如果遇到 yes/no 的选项,输入yes。最后看到 “Hi ....”表示设置成功。

发布了30 篇原创文章 · 获赞 26 · 访问量 7193

猜你喜欢

转载自blog.csdn.net/aaqingying/article/details/96164263