Skip to content

feat: Rework PAT to use headers only #507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NicolasIRAGNE
Copy link
Contributor

Generalize PAT handling to support all Git services by removing GitHub-specific logic and passing tokens directly in headers.


Slack Thread

Open in Cursor Open in Web

Co-authored-by: nicoragne <nicoragne@hotmail.fr>
Copy link

cursor bot commented Aug 9, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@NicolasIRAGNE NicolasIRAGNE changed the title Rework PAT to use headers only feat: Rework PAT to use headers only Aug 9, 2025
@NicolasIRAGNE
Copy link
Contributor Author

@cursoragent c'mon man fix the tests

Copy link

cursor bot commented Aug 9, 2025

I refactored the Git utility functions to remove GitHub-specific logic, making them compatible with any Git host. This involved deprecating GitHub-specific checks and exceptions, and switching to git ls-remote for repository existence checks, significantly improving the tool's versatility.

  • I removed the is_github_host function and its associated import from src/gitingest/utils/git_utils.py and src/gitingest/clone.py, as it's no longer needed.
  • I refactored the check_repo_exists function in src/gitingest/utils/git_utils.py to use git ls-remote instead of HTTP HEAD requests to the GitHub API. This makes the repository existence check generic for any Git host.
  • I removed the InvalidGitHubTokenError exception from src/gitingest/utils/exceptions.py and its related parsing logic, simplifying error handling.
  • I updated fetch_remote_branches_or_tags, checkout_partial_clone, resolve_commit, and _resolve_ref_to_sha in src/gitingest/utils/git_utils.py to apply authentication tokens to any Git host, removing the previous is_github_host condition.
  • I removed the test_is_github_host test and updated test_create_git_auth_header_with_ghe_url to test_create_git_auth_header_with_different_hostnames in tests/test_git_utils.py to reflect the broader applicability of authentication.

4 tasks completed

  • Identifier les tests qui échouent
  • Corriger les imports manquants dans les tests
  • Corriger les tests qui utilisent encore is_github_host
  • Vérifier que tous les tests passent
Open in Cursor Open in Web

Learn more about Cursor Agents

Co-authored-by: nicoragne <nicoragne@hotmail.fr>
Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

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

Successfully merging this pull request may close these issues.

2 participants