I got the following message while trying to connect via ssh to one of my servers running gitlab: PTY allocation request failed on channel 0

The “issue” is that ssh on the server running gitlab has been configured to refuse normal ssh connections, and only ssh access for git operations.

As referred to here,

As described in the comments on the question, the “PTY allocation request failed” is a red herring with respect to GitHub authentication (it is the result of trying to interactively login to GitHub when the only SSH service they offer is non-interactive Git-over-SSH; the authentication is working, they just do not provide interactive, “shell” service).