本地Git环境配置

解决GitBash下获取源码权限问题
本文提供了解决GitBash下获取源码时出现'permission denied public key'错误的方法,包括生成SSH文件、配置SSH-agent、将SSH密钥添加到GitHub账号等步骤。通过遵循指南,用户可以顺利配置并执行clone命令,实现源码获取。

在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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值