0

I've been trying to get git working on my laptop using both my github.com account and my github enterprise account. I've been following this guide and this one to figure out how to edit the SSH config file and get authenticated. I also looked at this SO question which is pretty similar, and did the ssh-add mentioned on there (for both keys).

So in total, I created separate public keys in the different folders (github and github_enterprise) and added them on both accounts online. I then edited the SSH config file to include the different sites, usernames, and keys, then did an ssh-add (ie: ssh-add ~/.ssh/github.com/id_rsa and ~/.ssh/github_enterprise/id_rsa). I tried to ssh (by doing ssh github.com or ssh github_enterprise), but it times out and I have to do control X-C.

This is my SSH config file:

Host github.com
    HostName github.com
    Port 4096
    IdentityFile /home/my_username/.ssh/github/id_rsa
    User my_github.com_username


Host github_enterprise
    HostName github_enterprise
    Port 4096
    IdentityFile /home/my_username/.ssh/github_enterprise/id_rsa
    User my_github_enterprise_username
Community
  • 1
  • 1
mdegges
  • 963
  • 3
  • 18
  • 39

1 Answers1

2

Port 4096 does not look right, it should be Port 22 or omitted altogether as that's the default anyway. Also the generic username to connect to GitHub via SSH is git, like in User git. Do not use you GitHub username here.

sschuberth
  • 28,386
  • 6
  • 101
  • 146
  • Ok thanks, I deleted that from the config file. (I think I added them because they showed up after doing ls -l ~/.ssh). I'm still running into the same timeout. – mdegges Jul 31 '15 at 19:03
  • Which host did you try, the regular or the enterprise one? Because for the enterprise one also the `HostName` looks wrong. This needs to be a fully qualified domain name. If you continue to have problems, look at the output of `ssh -vvv github.com` for hints what's wrong. – sschuberth Jul 31 '15 at 19:12
  • 1
    Oh, one more thing, for GitHub the SSH user name always needs to be *git*, like in `User git`. Do not use your GitHub user name here. You get identified by your key, not by your user name. – sschuberth Jul 31 '15 at 19:14
  • Thanks, that was it! I was using my github.com and enterprise usernames. Now I'm getting "PTY allocation request failed on channel 0.. Hi user! You've authenticated.. Connection to github.com closed." I will google around and see what to do about that – mdegges Jul 31 '15 at 19:19
  • Finally, if a (corporate) firewall might be blocking SSH connections on port 22 on your side, see the help for [Using SSH over the HTTPS port](https://help.github.com/articles/using-ssh-over-the-https-port/) to work around that. – sschuberth Jul 31 '15 at 19:19
  • Glad it worked. The message you're getting is not an error. You're just not supposed to run an interactive shell on GitHub, which is what PuTTY tried to do by default. You're just supposed to transfer data over it, i.e. clone / pull / push via Git. – sschuberth Jul 31 '15 at 19:22