Connecting to a TFS Git Repository

Yesterday I started working with a client who uses TFS with Git. My outlook.com account was added to the repo and Visual Studio 2017 connected fine once I was logged-in with this account.
I then wanted to pull the repo Visual Studio for Mac and discovered it's impossible using the Microsoft account outlook.com credentials - I just got unathorized messages.

I tried it in Git Bash too and had the same results. I think when Visual Studio connects on Windows it must stash a token which it then uses to authenticate itself and never uses the Microsoft account username and password.

Normally when I connect to GitHub or BitBucket using HTTPS, I only use a simple user name and password combiation so figured it must be possible, but not with the Microsoft email address. After a fair amount of googling, I discovered that there is the concept of Alternate authentication credentials

If you login to .visualstudio.com and click Manage security next to the repository:

Manage security

You get the security menu where you can select Alternate authentication credentials:

Manage security

In here, you can create your Alternate authentication credentials:

Alternate auth

Once saved, the .visualstudio.com Git repository can be cloned either from Git or Visual Studio for Mac using these credentials.