18

I'm wondering what the -T option in the following command does, cannot see this option in the manual somehow:

$ ssh -T git@gitlab.com
Welcome to GitLab, Simeon !

Could somebody explain?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Simeon Leyzerzon
  • 18,658
  • 9
  • 54
  • 82
  • 1
    Perhaps your man page is defective. Take a look at this webified man page: [man ssh on openbsd.org](http://man.openbsd.org/ssh#T). It says that `-T` will -T disable pseudo-terminal allocation. –  Nov 12 '17 at 05:26

1 Answers1

27

I explained before what TTY was: a text terminal is needed when you open an interactive session to a remote server.

But: in the context of a remote Git repository hosting server (GitHub, Gitlab, BitBucket, ...), no remote server will ever allow you to open an interactive session (for security reason)

Then only reason why you would still do an ssh -T git@github.com would be to test if you are correctly authenticated, and the session would immediately end with:

Hi username!  You've successfully authenticated, 
but GitHub does not provide shell access. 

Since no tty is needed for that test, you should use the -T option when making this test.

Simeon Leyzerzon
  • 18,658
  • 9
  • 54
  • 82
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 2
    So, the ssh option -T means "non-interactive TTY terminal" basically? – user3808269 Nov 03 '21 at 22:55
  • 1
    @user3870315 Normally, `T` is about TTY, not "interactive", as illustrated with Docker (https://stackoverflow.com/a/35551071/6309). But with SSH, since stdin is generally not easily accessible (https://stackoverflow.com/q/1340366/6309), removing TTY renders the session effectively non-interactive indeed. – VonC Nov 04 '21 at 06:40