我有一个谜要问你们!
在这个问题上苦苦挣扎了半天之后,我需要你的经验来启发我在 Windows 上使用 msysgit 来使用 git。
上下文:
- 视窗8
-
msysgit, 最新版本
- Using SSH密钥认证
-
Pagent使用 valid 处理 SSH 密钥身份验证.ppkkey(使用PuTTY登录即可)
- The 裸存储库是健康的,权限确定。使用 git linux 客户端(在本地 Ubuntu VM 上使用相同的 SSH 密钥进行测试)
Env:
- GIT_SSH=D:\path\to\PuTTY\plink.exe
- HOME=C:\路径\到\我自己
问题:
Short:
error: insufficient permission for adding an object to repository database ./obj
Long:
D:\path\to>git clone ssh://[email protected] /cdn-cgi/l/email-protection/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://[email protected] /cdn-cgi/l/email-protection/opt/git/project
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'ssh://[email protected] /cdn-cgi/l/email-protection/opt/git/project'
我真诚地接受任何形式的帮助,提前致谢..!
顺便说一下,这到底是怎么回事Unable to use key file "D:\path\to\puttykey.ppk"
??
大多数答案,如“推送到 GitHub 时出错 - 权限不足,无法将对象添加到存储库数据库 https://stackoverflow.com/q/1918524/6309”提到了有关文件夹访问权限的问题。
这转化为 chmod...这并不真正适用于 Windows。
But 这个答案 https://stackoverflow.com/a/15319683/6309提到了same当您的 ssh url 引用您的 ssh 中的条目时出现错误消息%HOME%/.ssh/config
文件,该文件用于另一个公共/私有 ssh 密钥,而不是您要使用的密钥。
确保您的网址使用正确的条目,正如我在“使用 ssh 访问存储库 https://stackoverflow.com/a/22579676/6309"
Host aKey
User git
HostName yourHost
Port 22
IdentityFile ~/.ssh/<[email protected] /cdn-cgi/l/email-protection>.key
在这里,OP blint https://stackoverflow.com/users/2219133/blint adds 在评论中 https://stackoverflow.com/questions/23035302/git-push-over-ssh-on-windows-wont-work/23035735?noredirect=1#comment35193283_23035735:
消息Unable to use key file "D:\path\to\puttykey.ppk"
因此是由于受控 PuTTY 配置文件中定义的路径错误.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)