Please make sure you have the correct access rights and the repository exists.问题解决

Permission denied (publickey).
fatal: Could not read from remote repository.

是公钥出问题了,要先设置用户和邮箱再重新生成ssh公钥即可。

1.首先我得重新在git设置一下身份的名字和邮箱 进入到需要提交的文件夹底下(因为直接打开git Bash,在没有路径的情况下,根本没!法!改!刚使用git时遇到的坑。。。)

git config --global user.name “yourname”

git config --global user.email “your@email.com”

注:yourname是你要设置的名字,your@email是你要设置的邮箱。

2.删除 .ssh 文件夹【C:\Users(本地用户名).ssh】 中的 known_hosts(直接删除即可)

3.在下载好的Git中的bin目录下(一般是 C:\Program Files\Git\bin)打开bash.exe输入命令

$ ssh-keygen -t rsa -C “your@email.com”(请填你设置的邮箱地址)
如果执行成功。返回:
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/your_user_directory/.ssh/id_rsa):
如果以前有存储地址会返回/Users/your username/.ssh/id_rsa already exists.Overwrite (y/n)?直接输入y回车。
如果以前没有储存地址就会出现Enter passphrase(empty for no passphrase);也直接回车,
两种情况回车后都会出现 Enter same passphrase again 然后接着回车会显示
The key’s randomart image is:
±–[RSA 2048]----+
| .o== oo+.o.oo. |
|…+=++…O =… . |
|.o.+oo+.B o o o |
| o…o.o . o |
| o…S o |
| . . o… |
| . . o o |
|. . + |
|oE .o . |
±—[SHA256]-----+

4.然后找到系统自动在.ssh文件夹下生成两个文件,id_rsa和id_rsa.pub,用记事本打开id_rsa.pub将全部的内容复制。

5.打开https://github.com/,登陆账户,进入设置(Settings)找到

6.然后将你复制的内容粘贴到key中 再点击Add SSH Key

7.仍然在bash.exe中输入ssh -T git@github.com然后会跳出一堆内容你只需输入yes回车就完事了,然后他会提示你成功了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值