Clone fails with SSH and two-factor authentication
I have a Raspberry Pi which I use for storing my Git repo with passwords. I only allow connections to it via SSH and public keys. However, I also use two-factor authentication from the Google Authenticator app, which generates a time based one-time password every 30 seconds. Thus, every time I log in from a computer, my key is first verified and then I'm prompted for my one-time password from the Google Authenticator app on the terminal.
However, this setup causes the cloning process to fail with the following error message (the removed part is the server URL):

Removing the requirement of using the time based one-time password makes the cloning process proceed so it appears it has to do with the two factor authentication.
Is there any way to make cloning work with two factor authentication?
On Github at least, you can get around this by creating a Personal Access Token as per https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
Adding support for 2FA tokens is not planned as of now. GitHub does not prompt for 2FA login when using SSH keys so I'm confused why GitLab decided to.