When I connect to a TFS server using Git, the Git Credential Manager for Windows pops up a Microsoft login box. However, when I connect to a GitHub server, it raises a different login dialog for GitHub. I want to know what conditions the Git Credential Manager uses to control its popup box. It is the server. The server return value? The hostname?
-
1You mentioned a popup box, so you are using some Git GUI tool, aren't you? When you connect to a server, the tool must know the url which contains information about the transport protocol, the server address and the repository path. The server would ask for credential if necessary. – ElpieKay May 02 '18 at 08:06
-
Thanks,If I understand you correctly, You want to say that different login boxes are determined by the server. If I want to log in to the server, how do I determine whether to use a different login method, whether to use the server's host or to have some judgment interface provided by Git? – alpha May 02 '18 at 09:43
1 Answers
It's based on the URL. Open the Credential Manager and you'll see something like this:
More details on the exact workflow are from here:
Manager flow:
git-credential finds that credential.helper=manager and invokes git-credential-manager with the "get" option.
git-credential-manager lacks credentials for the + . git-credential-manager looks at configuration + to determine if these are basic credentials, VSO m-factor, or GitHub 2-factor authentication.
In the case of basic credentials, git-credential-manager tells git-credential the truth that it does not have any credentials for it.
git-credential then prompts the user at the command line for credentials.
The user enters credentials.
git-credential invokes git-credential-manager with the store option and supplies the credentials for storage.
Further configuration can help you set a specific authorizing method, i.e. if I wanted to use NTLM to authorize communications with a TFS hosted git repo, I would enter
git config --system credential.myserver.com.authority Integrated
which would explicitly tell all repos to use Integrated/NTLM instead of having the user enter their username/password (not even once). Obviously, change myserver.com to your own domain. This also has the added advantage of not breaking when the user has to update their password. Otherwise, they'd have to manually delete/modify the credentials from the Credential Manager.

- 10,323
- 3
- 29
- 56