Skip to content

Conversation

@danchev
Copy link
Contributor

@danchev danchev commented Jul 26, 2025

Description

This pull request introduces improvements to the detection and handling of Git credential helpers in the Huggingface Hub client for Linux environments.

Summary of the last two commits

  1. Support for Git Credential Manager (GCM)

  2. Support for git-credential-libsecret

    • Extended the regex to recognize git-credential-libsecret, enabling integration with Secret Service-compatible keyrings (e.g., GNOME Keyring, KDE Wallet) on Linux.
    • Added unit tests to validate detection and handling of git-credential-libsecret.
    • Ref: https://git-scm.com/doc/credential-helpers

These changes improve compatibility with modern credential storage solutions and enhance security for Linux users.

danchev added 2 commits July 26, 2025 00:20
- Update GIT_CREDENTIAL_REGEX to match git-credential-manager
- Add tests to verify GCM is recognized and handled

Ref: https://git-scm.com/doc/credential-helpers
…tion

- Extend GIT_CREDENTIAL_REGEX to recognize git-credential-libsecret, enabling integration with Secret Service-compatible keyrings (e.g., GNOME Keyring, KDE Wallet) on Linux.

- Add unit tests to validate detection and handling of git-credential-libsecret

Ref: https://git-scm.com/doc/credential-helpers
Copilot AI review requested due to automatic review settings July 26, 2025 05:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the git credential helper parsing to support a broader range of helper names and paths, expanding beyond simple word characters to include hyphens and absolute paths.

  • Updates regex pattern to handle git credential helpers with hyphens and absolute paths
  • Adds test coverage for new credential helper formats including git-credential-manager and absolute paths

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/huggingface_hub/utils/_git_credential.py Updates regex pattern to capture credential helpers with hyphens and absolute paths
tests/test_utils_git_credentials.py Adds test data and assertions for new credential helper formats

@danchev danchev marked this pull request as draft July 26, 2025 05:32
@danchev danchev changed the title Create PR from danchev:huggingface_hub:main to main Improve Git Credential Helper Detection for Linux (GCM & libsecret support) Jul 26, 2025
@danchev danchev marked this pull request as ready for review July 26, 2025 05:35
Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Thanks for opening this PR and adding tests @danchev ! Changes make total sense IMO so let's merge it :)

@Wauplin
Copy link
Contributor

Wauplin commented Jul 28, 2025

FYI, it's also possible to clone a repo using git+ssh instead of git+https which makes it unnecessary to use a git credential helper in that case. That was not possible when we first introduced support for git credential helpers. Both approaches are perfectly valid, I just wanted to mention :)

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@Wauplin Wauplin merged commit d23abb3 into huggingface:main Jul 28, 2025
20 of 21 checks passed
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.

3 participants