我为你们带来了一个谜!
在这个问题上经过半天的努力,我需要你的经验来启发我使用msysgit在Windows上使用git。
上下文:
ENV:
问题:
短:
error: insufficient permission for adding an object to repository database ./obj
长:
D:\path\to>git clone ssh://git@my.server.net/opt/git/project
Cloning into 'project'...
Unable to use key file "D:\path\to\puttykey.ppk" (unable to open file)
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
Checking connectivity... done.
D:\path\to>cd project
...me creating some random file...
D:\path\to\project>git add test
D:\path\to\project>git commit -m "Init"
[master 118a94e] Init
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test
D:\path\to\project>git push origin master
Unable to use key file "D:\path\to\puttykey.ppk" (unable to open file)
Counting objects: 2, done.
Writing objects: 100% (2/2), 293 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 2 (delta 1)
error: insufficient permission for adding an object to repository database ./obj
fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To ssh://git@my.server.net/opt/git/project
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'ssh://git@my.server.net/opt/git/project'
我老老实实地接受任何形式的帮助,谢谢你提前......!
顺便说一句,这个Unable to use key file "D:\path\to\puttykey.ppk"
??
答案 0 :(得分:3)
大多数答案,如" Error pushing to GitHub - insufficient permission for adding an object to repository database"提到了文件夹中访问权限的问题 这转化为chmod ......它并不适用于Windows。
但是当{s}网址引用%HOME%/.ssh/config
文件中的条目时,this answer提到相同的错误消息,该条目用于另一个公共/私有ssh密钥而不是您想要的密钥使用。
确保您的网址使用了正确的条目,正如我在" access repository with ssh"
中解释的那样Host aKey
User git
HostName yourHost
Port 22
IdentityFile ~/.ssh/<stranger@gmail.com>.key
此处,OP blint添加in the comments:
因此,由于在有罪的PuTTY个人资料中定义了错误的路径,因此消息Unable to use key file "D:\path\to\puttykey.ppk"
。