简体   繁体   English

Windows上的Git push over SSH将无法正常工作

[英]Git push over SSH on Windows won't work

I've got an enigma for you guys! 我对你们有一个谜!

After an half a day struggle on this issue, I require your experience to enlighten me on git usage on Windows with msysgit. 在这个问题上经过半天的努力,我需要你的经验来启发我使用msysgit在Windows上使用git。

The context: 上下文:

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

Env: ENV:

  • GIT_SSH=D:\\path\\to\\PuTTY\\plink.exe GIT_SSH = d:\\路径\\到\\腻子\\ plink.exe
  • HOME=C:\\path\\to\\myself HOME = C:\\路径\\为\\自己

The issue: 问题:

Short: 短:

error: insufficient permission for adding an object to repository database ./obj

Long: 长:

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..! 我老实说接受任何形式的帮助,谢谢你提前......!

By the way, what the hell with this Unable to use key file "D:\\path\\to\\puttykey.ppk" ?? 顺便说一句,这个Unable to use key file "D:\\path\\to\\puttykey.ppk"

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. 大多数答案,如“ 错误推送到GitHub - 将对象添加到存储库数据库的权限不足 ”中提到的问题,提到了文件夹中访问权限的问题。
That translates into chmod... which doesn't really apply on Windows. 这转化为chmod ...这并不适用于Windows。

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 url引用%HOME%/.ssh/config文件中的条目时, 此答案提到相同的错误消息,该文件用于另一个公共/私有ssh密钥,而不是您要使用的条目。

Make sure your url uses the right entry, as I explain in " access repository with ssh " 确保您的网址使用正确的条目,正如我在“ 使用ssh访问存储库 ”中所述

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

Here, the OP blint adds in the comments : 这里, OP blint 在评论中添加:

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 . 因此, Unable to use key file "D:\\path\\to\\puttykey.ppk"由于在被控制的PuTTY配置文件中定义的错误路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM