Windows上的Git通过SSH推送不起作用 [英] Git push over SSH on Windows won't work

查看:399
本文介绍了Windows上的Git通过SSH推送不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为你们带来了一个谜!

I've got an enigma for you guys!

在这个问题上经过半天的努力之后,我需要您的经验来启发我使用msysgit在Windows上使用git.

After an half a day struggle on this issue, I require your experience to enlighten me on git usage on Windows with msysgit.

上下文:

  • Windows 8
  • msysgit ,最新版本
  • 使用 SSH 密钥身份验证
  • 代理使用有效的 .ppk 密钥处理SSH密钥身份验证(使用PuTTY登录是可以的)
  • 裸仓库是健康的,权限确定.使用git linux客户端(在具有相同SSH密钥的本地Ubuntu VM上测试)
  • Windows 8
  • msysgit, last version
  • Using SSH Key authentication
  • Pagent handles SSH key authentication using valid .ppk key (logon with PuTTY is OK)
  • The bare repository is healthy, with permissions OK. Working with git linux client (tested on local Ubuntu VM with the same SSH key)

环境:

  • 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'

老实说,我很乐意接受任何帮助..

I'm honestly accepting any kind of help, thanks by advance..!

顺便问一下,Unable to use key file "D:\path\to\puttykey.ppk"到底是怎么回事?

By the way, what the hell with this Unable to use key file "D:\path\to\puttykey.ppk"??

推荐答案

大多数答案,如"中的错误GitHub-权限不足,无法将对象添加到存储库数据库"提到了有关文件夹中访问权限的问题.
转化为chmod ...在Windows上并不真正适用.

Most of the answers, as the ones in "Error pushing to GitHub - insufficient permission for adding an object to repository database" mentions an issue around access rights in folder.
That translates into chmod... which doesn't really apply on Windows.

但是此答案在您的ssh url引用了以下条目时提到了 same 错误消息.您的%HOME%/.ssh/config文件是您要使用的另一个公/私ssh密钥.

But this answer mentions the same error message when your ssh url reference an entry in your %HOME%/.ssh/config file which is for another public/private ssh key than the one you want to use.

请确保您的网址使用正确的条目,正如我在"使用ssh访问存储库"中所述

Make sure your url uses the right entry, as I explain in "access repository with ssh"

Host aKey
    User git
    HostName yourHost
    Port 22
    IdentityFile ~/.ssh/<stranger@gmail.com>.key

在这里, OP盲点添加

因此,消息Unable to use key file "D:\path\to\puttykey.ppk"归因于所确定的PuTTY配置文件中定义的错误路径.

这篇关于Windows上的Git通过SSH推送不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆