Skip to content

Add git insteadof example #273

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

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

Conversation

multimeric
Copy link

Closes #270.

@Copilot Copilot AI review requested due to automatic review settings August 11, 2025 03:53
@multimeric multimeric requested a review from a team as a code owner August 11, 2025 03:53
Copy link

@Copilot 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 adds documentation for configuring Git to use GitHub App tokens for authentication, addressing issue #270. The addition provides guidance for scenarios where tools use Git directly but cannot accept GitHub API tokens.

  • Adds a new documentation section explaining Git's insteadof configuration option
  • Provides a complete workflow example for Python projects with private Git dependencies
  • Includes additional configuration examples for repository and organization-specific authentication

# required
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Configure git to use the app token
Copy link
Preview

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

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

The placeholder 'USERNAME' in the Git URL is not explained. Consider clarifying what value should be used here or if it's a literal placeholder that Git ignores for token-based authentication.

Suggested change
- name: Configure git to use the app token
- name: Configure git to use the app token
# The USERNAME part of the URL can be any non-empty string (e.g., 'x-access-token'), as GitHub ignores it when a token is used.

Copilot uses AI. Check for mistakes.

The above example will use the same token for all `git` operations on GitHub via `https`, but you can configure it on a per repository or per-organisation basis by changing the prefix:

```bash
git config --global url."https://USERNAME:${GITHUB_TOKEN}@github.com/MyOrg/MyRepo".insteadOf "https://github.com/MyOrg/MyRepo"
Copy link
Preview

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

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

This example uses the same unexplained 'USERNAME' placeholder. For consistency and clarity, this should match the explanation provided for the main example above.

Suggested change
git config --global url."https://USERNAME:${GITHUB_TOKEN}@github.com/MyOrg/MyRepo".insteadOf "https://github.com/MyOrg/MyRepo"
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/MyOrg/MyRepo".insteadOf "https://github.com/MyOrg/MyRepo"

Copilot uses AI. Check for mistakes.

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 insteadOf usage example
1 participant