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.

The context:

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

Env:

  • GIT_SSH=D:\path\to\PuTTY\plink.exe
  • HOME=C:\path\to\myself

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"??

  • How can Windows file and folder shortcuts be created via C#.NET code?
  • How to merge from upstream branch?
  • error: cannot run ssh: No such file or directory when trying to clone on windows
  • warning: templates not found /share/git-core/templates | fatal: Unable to find remote helper for 'https'
  • Is it safe to use git with multiple users when the central repository is on a windows file share?
  • git crlf configuration in mixed environment
  • Remove credentials from Git
  • Git clone / pull continually freezing at “Store key in cache?”
  • One Solution collect form web for “Git push over SSH on Windows won't work”

    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.

    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.

    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
    

    Here, the OP blint adds 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.

    Git Baby is a git and github fan, let's start git clone.