153

I was trying to setup an SSH connection with Github following this tutorial:

I came across the following command:

$ ssh -T git@github.com 
# Attempts to ssh to github

Curious, I looked at the ssh manual. It said the following:

 -T      Disable pseudo-tty allocation.

What is tty allocation? What does tty stand for? Why are we disabling it?
I earnestly tried to look it up but I was unable to find even a definition.

Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
user2316667
  • 5,444
  • 13
  • 49
  • 71
  • 1
    Maybe it has something to do with [Pseudo terminals](http://en.wikipedia.org/wiki/Pseudo_terminal)? Also, did you really find nothing of use when you [googled pseudo tty-allocation](https://www.google.com/search?q=pseudo-tty+allocation)? –  Jul 27 '13 at 18:53
  • 1
    Who knew pseudo terminals had anything to do with tty. I actually did find that link but thought it had nothing to do with tty allocation, heh. Thanks! – user2316667 Jul 28 '13 at 17:39
  • 12
    I was setting up SSH connection, I was following the same tutorial, and I was like what's this -T option, out of curiosity I looked at the ssh man page, and then I had the same questions you had! – Siddhartha Apr 16 '15 at 18:01

1 Answers1

132

As explained in "gitolite: PTY allocation request failed on channel 0", it is important to do ssh test connection with -T, because some server could abort the transaction entirely if a text-terminal (tty) is requested.

-T avoids requesting said terminal, since GitHub has no intention of giving you an interactive secure shell, where you could type command.

GitHub only wants to reply to your ssh request, in order to ascertain that the ssh command does work (you have the right public/private keys, and the public one has been registered to your GitHub account)

PuTTy would be an example of a terminal emulator, serial console and network file transfer application. It supports several network protocols, including SCP, SSH, Telnet and rlogin.
The name "PuTTY" has no definitive meaning, though "tty" is the name for a terminal in the Unix tradition, usually held to be short for Teletype.


Other use-cases for -T (beside testing)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 5
    thanks. is -T only used for testing connection, since it avoids allocating tty? – Tim Jun 09 '16 at 22:28
  • 9
    @Tim No, it can be useful (to disable tty) when transferring binary files (http://serverfault.com/a/746638/783) or to execute commands on a remote server (http://unix.stackexchange.com/a/88616/7490) – VonC Jun 10 '16 at 19:53