Allow git credential manager to provide multiple credentials to try for the same URL
As of the upgrade to isomorphic-git 1.8, the authentication mechanism in isomorphic-git now works as a loop. This opens up the possibility of trying multiple entries from the git credentials file instead of the first one that matches the URL.
There are several possible ways to implement this in the git credential manager interface in a backward compatible way:
- Allow the fill method on the git credential manager to return an array of credentials instead of a single one; the code in Antora would then be updated to accommodate either return type
- Call the fill method again after the credentials are rejected and see if it returns a different value; if it does, Antora would try the new credentials; otherwise, it would assume there are no other credentials to try and proceed with the rejected flow
- Same as the previous approach, but pass in any credentials which have been previously rejected so the fill method knows which ones to skip
The most viable options are (1) and (3). (2) requires the git credential manager to maintain state between the fill calls, which may not be ideal (and it could still choose to if we implement (3)). I think we should try (1) first, and only (3) if we find that doesn't work out.
The workaround to the problem of having different tokens for different repositories on the same git host is to use repository-specific entries in the git credentials file. This workaround should be documented.