我有一个谜题要问你们!
在这个问题上折腾了半天之后,我需要你的经验来启发我在 Windows 上使用 msysgit 使用 git。
上下文:
- Windows 8
- msysgit,最新版本
- 使用SSH key 认证
- Pagent 使用有效的 .ppk key 处理 SSH key 身份验证(可以使用 PuTTY 登录)
- 裸存储库是健康的,权限正常。使用 git linux 客户端(在具有相同 SSH key 的本地 Ubuntu VM 上测试)
环境:
- GIT_SSH=D:\path\to\PuTTY\plink.exe
- HOME=C:\path\to\myself
问题:
简短:
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"
到底是怎么回事??
最佳答案
大多数答案,如“Error pushing to GitHub - insufficient permission for adding an object to repository database”中的答案,都提到了文件夹访问权限的问题。
这转化为 chmod... 这在 Windows 上并不真正适用。
但是this answer当您的 ssh url 引用您的 %HOME%/.ssh/config
文件中的条目时提到相同错误消息,该条目用于另一个公共(public)/私有(private) ssh key 而不是您的想用。
确保您的网址使用正确的条目,正如我在“access repository with ssh”中所解释的那样
Host aKey
User git
HostName yourHost
Port 22
IdentityFile ~/.ssh/<stranger@gmail.com>.key
在这里,OP blint添加 in the comments :
the message
Unable to use key file "D:\path\to\puttykey.ppk"
was therefore due to a wrong path defined in the incriminated PuTTY profile.
关于windows - Git 在 Windows 上通过 SSH 推送将无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23035302/