本地Git环境配置

在Git Bash下获取源码时,提示permission denied publickey。

原因是本地帐号配置不正确,解决办法

生成SSH文件

1,进入Git Bash

2,  输入下面文字

ssh-keygen -t rsa -b 4096 -C "这里为github帐号“

待提示 "Enter a file in which to save the key," ,直接回车,保存在默认位置

待提示”type a secure passphrase“, 输入一个密码

把生成的SSH文件添加到ssh-agent

1,确保ssh-agent启用

eval "$(ssh-agent -s)"


2,添加SSH key 到ssh-agent:

ssh-add ~/.ssh/id_rsa

SSH key添加到GitHub帐号中

参照:https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

经过上面配置后,执行clone命令成功

git clone git@github.com:spring-projects/spring-framework.git

参考:https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/



签名:删除冗余的代码最开心,找不到删除的代码最痛苦!
原文地址:https://www.cnblogs.com/season2009/p/5235739.html