2

When I try to push to a repo on Github from Windows Command Prompt I get the error Permission denied (public key). Troubleshooting via the instructions from ssh-issues reveals that ssh cannot find any of the files it needs in my .ssh:

>ssh -vT git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to github.com [192.30.253.113] port 22.
debug1: Connection established.
debug1: identity file /.ssh/identity type -1
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-sha1 none
debug1: kex: client->server aes128-cbc hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/identity
debug1: Trying private key: /.ssh/id_rsa
debug1: Trying private key: /.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

The 3 files that it cannot find are in my .ssh file along with a config file to set the identity. I know the files exist and it's working because this works perfectly in GitBash. Furthermore what is the issue with doing this in cmd, is there some problem with OpenSSH or something? How do I fix this?

NOTE: I want to get this working in cmd I do not want to use GitBash or CYGWIN!

2
  • The method I use to fix such problems is using the free tool Process Monitor from Sysinternals (Microsoft) with just showing file system activity (look on last 5 icons on toolbar and their tooltips) and run the application/script which can't find some files. Once knowing where the application/script is searching for which files, it is often easy to find the files by oneself and correct the configuration or file location.
    – Mofi
    Aug 29, 2016 at 18:14
  • @Mofi I don't quite follow. Let me put it like this...when you push to a remote repo on github via the repo's ssh link do you encounter the issue I am having? /.ssh/identity is declared in my config file and is not a actual file in .ssh. As I mentioned in my post this works perfectly in GitBash but in command prompt none of the files can be found.
    – coderrick
    Aug 30, 2016 at 3:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.