Skip to content

Conversation

Copy link

Copilot AI commented Nov 4, 2025

Implements support for git credential helpers as master password sources. Git credential helpers provide a standardized protocol for retrieving credentials from various backends (cache, store, OS keychains, etc.) using URLs as lookup keys.

Implementation

  • GitCredentialHelperMasterSource: New master source following the PrefixMasterSourceSupport pattern
  • Configuration format: git-credential:helper-name?url=protocol://host/path
    • Helper name can be short form (e.g., cache) or full path to executable
    • URL serves as artificial lookup key for credential storage
  • Protocol handling: Executes helper with get action, writes URL components to stdin, parses password= field from stdout
  • Validation: Checks helper availability by attempting execution with closed stdin

Usage

<!-- Use git-credential-cache -->
<masterSource>git-credential:cache?url=https://maven.apache.org/master</masterSource>

<!-- Use OS keychain on macOS -->
<masterSource>git-credential:osxkeychain?url=https://maven.apache.org/master</masterSource>

<!-- Use custom helper -->
<masterSource>git-credential:/usr/local/bin/my-helper?url=https://maven.apache.org/master</masterSource>

Store credentials using standard git credential protocol:

echo -e "protocol=https\nhost=maven.apache.org\npath=/master\npassword=yourPassword\n" | git-credential-store store

Testing

Comprehensive unit tests with mock helper execution covering configuration parsing, validation, and cross-platform compatibility.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add Git Credentials Helper as master source</issue_title>
<issue_description>There are lots of git credentials helper listed in https://git-scm.com/doc/credential-helpers.

As all have a common way of how they are parameterized and return credentials they can be added as master source as well.

As Git Credential helpers always use a URL as lookup key one would need to use an artificial URL to lookup the correct entry. In addition one would need to add the filename of the credential helper binary.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add Git Credentials Helper as master source Add Git Credential Helper as master password source Nov 4, 2025
Copilot AI requested a review from kwin November 4, 2025 21:00
Copilot finished work on behalf of kwin November 4, 2025 21:00
return password;
}

private String buildHelperCommand(String helperName) {
Copy link
Contributor

@kwin kwin Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Turn into package protected static method to ease unit testing. Also adjust according unit tests to no longer rely on reflection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Git Credentials Helper as master source

2 participants