I am able to use ssh (i.e., for 'git' with heroku or github etc.) through GitBash, but I cannot do the same from Windows cmd prompt on the same machine. What can be the problem? If I recall correctly, it used to work from cmd prompt.
The error I'm getting is:
Permission denied (publickey). fatal: The remote end hung up unexpectedly
I got both logs: here is last four lines from cmd which are different from 'git bash':
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).
in case of Git bash: the respective lines are:
debug1: Trying private key: /c/Users/user1/.ssh/identity
debug1: Offering public key: /c/Users/user1/.ssh/id_rsa
debug1: Remote: Forced command: gerve user1
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
Resolved
As hinted by @snemarch, setting following env var solved my problem:
set HOME=C:\Users\user1
Git CMD is just like regular Windows command prompt with the git command. It lets you use all of Git features through command line. Useful if you are already familiar with Windows cmd and you only work on Windows. Git Bash emulates a bash environment on windows.
Yes, Git for Windows installs its own SSH client. It ships a version of OpenSSH with the package. If you're seeing /usr/bin/ssh when you run command -v ssh , then you're using the version from Git for Windows.
Since you are using GitHub, from cmd try
ssh -v -T [email protected]
See the keys that it is presenting. Maybe try from Git Bash also and compare the output.
This could be because %HOME% is not correctly set. Set it to the directory that contains your .ssh
directory ( and hence the keys)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With