Check your environment variables for GIT_SSH
. If it is set, then unset it to stop using PuTTY for your SSH client. You're trying to use openssh config options, so you want to use the openssh included with msysgit.
How to make MSysGit work with non-default key file names?
-
18-03-2022 - |
Question
In order to use multiple keys for multiple GitHub accounts (after this how-to) I want first to get my local system working with key files that are named other than the default id_rsa
.
I created a key pair id_rsa_user
& id_rsa_user.pub
and added the private key part to the SSH Authentification agent and the public key part to GitHub ("Generating SSH Keys").
Then I created the file ~/.ssh/config
with this content:
#user account
Host github.com-user
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_user
Finally I changed the remote URL of the project from git@github.com:user/project.git
to git@github.com-user:user/project.git
(s. the comments to this how-to).
Now it's working on my VirtualBox-VM (Debian) and in TortoiseGit. But MSysGit throws an error:
(trying to push git@github.com:user/project.git)
***@**** /path/to/to/project (master)
$ git push
fatal: The remote end hung up unexpectedly
(trying to clone git@github.com-user:user/project.git)
***@**** /path/to/to/project (master)
$ git clone git@github.com-user:user/project.git .
Cloning into '.'...
fatal: The remote end hung up unexpectedly
(trying to clone git@github.com:user/project.git ):
***@**** /path/to/to/project (master)
$ git clone git@github.com:user/project.git .
Cloning into '.'...
fatal: The remote end hung up unexpectedly
Does someone have any idea, how to resolve this issue?
Thx
EDIT:
Addition information -- ssh -v git@github.com-user
output:
***@**** ~/Desktop/test
$ ssh -v git@github.com-user
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Users/avex/.ssh/config
debug1: Applying options for github.com-user
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /c/Users/avex/.ssh/id_rsa_user type 1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze1+github8
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze1+github8 pat OpenSSH*
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-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /c/Users/avex/.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: Offering public key: /c/Users/avex/.ssh/id_rsa_user
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Remote: Forced command: gerve user 8d:25:62:90:20:4e:89:99:85:42:2c:d6:0a:03:66:dc
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command: gerve user 8d:25:62:90:20:4e:89:99:85:42:2c:d6:0a:03:66:dc
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi user! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Connection to github.com closed.
debug1: Transferred: stdin 0, stdout 0, stderr 34 bytes in 0.6 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 61.2
debug1: Exit status 1
Solution