当前位置:  开发笔记 > 编程语言 > 正文

Git克隆.key_load_public:格式无效Permission denied(publickey)

如何解决《Git克隆.key_load_public:格式无效Permissiondenied(publickey)》经验,为你挑选了1个好方法。

我在Windows 10上使用puttygen.exe来生成私钥和公钥.我将这些密钥保存在C:\ Users\Alexander\.ssh \中

公钥被添加到远程仓库(不是由我.我没有访问权限).

然后我在Git Bash中使用了命令:

git clone git@ipaddress:project_name.git

我收到一个错误:

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

示例键(仅为例子生成)

id_rsa.ppk

PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20170110
Public-Lines: 6
AAAAB3NzaC1yc2EAAAABJQAAAQEAx0UhtZcgUT5XpoNlcoVFGHbArEsARQVCv5m0
TRh90Xq15gxOvL+x7I0B29xOuOP054RtQaOzHqnKUzpMdrIoZFkYEYJ11p42kC05
PVR/CwtKBuONJZzoIveJlNG1IhbC3G8DMZD5j68T5OVbCqftHMIBe4CTr7TewJ9T
/lmSZPytWXk/Xtcvn1i1TQZS2ShtSNOwtx77fLzkVmC6F4uM2JgJ9bSM2xQZTX/j
DYZTtoEsmyBadANAEZx4kQAoITwxXVRPBPJnB74EdSMXNhrDBJ+sZSEy7kxmc3a/
UK6CzdN3wiEMd/Bb1nuzR2cpWrWhniG66lnOTJb3sF8iiVtw7Q==
Private-Lines: 14
AAABAEtmRBsyQ5RcxzgWCrW14sr8gEExIrJVBH/ZSyQXGtmkDXmjysP1gZfGpsHk
qCpIaoEdWcXPPNsrfPzloGRDaTq57W5otvdCyImUkjLhs4ejaB5IQz6qEqVya2i+
DS9+O+S0YhLBO9WAhBFrijtiIl3oivB11wQ2mXlRCwZLZ9MugQ3rPfS0O/E2asrO
+MyiR2uv84lVb2wUT0Be3eeubnT2Qp8CoX3qV93LwBM053tepmD0jtSBsaXepADw
mdjBfIkUm+z/69PKtsEoYtIRe5DQRGQhUrwZasJnrfwAvdkr56NKM/rEL0ocUPDX
pXQalD88fKHKog5pr25c8aImklUAAACBAPmqhoRBWy+VJxgZ2BeMYv2PbmQCrQyp
ZVqua9byU59cANjarPcEb1zSUVEJyO8KlTW1eiTeMrya3cdrqbk3Rhp8XgolRsrv
ZK2rMQxP5nIoHyndtG1CCVqrWnwjIsb4r4cq2aBaUWjQJ+ofpiUHVkHev+h58zEA
zpDZs0Jrv5n7AAAAgQDMU04pqQ1hnv050gs8C2Gy+DjbW8b/NbQl64x0HFik/lWB
CRLrCd341ZQWY0PcU5ZjwNa8GwwJZPJI2bX84/a7dq2ENnT1+uYqpuK8lnPTcBDy
WjlGcf/fWJyJpdLqqXkMZ7or4k9ReVIXz9A8xRkhGEH2xM8Vk2fyoLY88RFUNwAA
AIA+zxdPdF8dPr8HwTJ5Pb0NQjl2likOxR24QmqxlCu/bD1p8R1tZzX5Jh2HP2on
RO+KVLYHzNKqtKRZW/MHftYcm6AvYLhP7hxG/tFoNM9lEmsqdJenxaWP745LP9Pc
k3qh7kC4KfTXyfgsd+C6dXzqhAokz81zL41QtyJxlQzR2w==
Private-MAC: ce79771084cbabf61fc2bf3b1403e42a9957e2af

id_rsa.pub

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20170110"
AAAAB3NzaC1yc2EAAAABJQAAAQEAx0UhtZcgUT5XpoNlcoVFGHbArEsARQVCv5m0
TRh90Xq15gxOvL+x7I0B29xOuOP054RtQaOzHqnKUzpMdrIoZFkYEYJ11p42kC05
PVR/CwtKBuONJZzoIveJlNG1IhbC3G8DMZD5j68T5OVbCqftHMIBe4CTr7TewJ9T
/lmSZPytWXk/Xtcvn1i1TQZS2ShtSNOwtx77fLzkVmC6F4uM2JgJ9bSM2xQZTX/j
DYZTtoEsmyBadANAEZx4kQAoITwxXVRPBPJnB74EdSMXNhrDBJ+sZSEy7kxmc3a/
UK6CzdN3wiEMd/Bb1nuzR2cpWrWhniG66lnOTJb3sF8iiVtw7Q==
---- END SSH2 PUBLIC KEY ----

这可能有什么问题?



1> Jakuje..:

Git正在使用OpenSSH,它不支持PuTTY密钥格式.您需要将其转换为OpenSSH格式.这在SO文档中有描述,现在在答案中无法在Jenkins配置中添加SSH密钥:

打开PuttyGen

单击加载

加载您的私钥

转到转化 - > 导出OpenSSH并导出您的私钥

将您的私钥复制到 ~/.ssh/id_rsa


是.将公钥移到上方或以openssh格式替换它.
推荐阅读
低调pasta_730
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有