我可以通过GitBash使用ssh(例如,对于heroku或github等使用``git''),但是我无法在同一台计算机上的Windows cmd提示符下执行相同的操作。可能是什么问题?如果我没记错的话,它曾经在cmd提示符下工作。
我得到的错误是:
Permission denied (publickey). fatal: The remote end hung up unexpectedly
我得到了两个日志:这是来自cmd的最后四行,与'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).
如果是Git bash:相应的行是:
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.
已解决
正如@snemarch所暗示的那样,设置以下env var解决了我的问题:
set HOME=C:\Users\user1
最佳答案
由于您使用的是GitHub,请从cmd尝试
ssh -v -T [email protected]
查看它所显示的键。也许也可以尝试从Git Bash比较输出。
这可能是因为%HOME%设置不正确。将其设置为包含
.ssh
目录的目录(以及相应的键)关于windows - Windows 7上的ssh问题(gitbash与Windows cmd),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8496891/