Skip to content

Fix false URL mismatch detection with insteadOf#3718

Open
rajatvig wants to merge 2 commits intobuildkite:mainfrom
rajatvig:fix-insteadof-url-mismatch
Open

Fix false URL mismatch detection with insteadOf#3718
rajatvig wants to merge 2 commits intobuildkite:mainfrom
rajatvig:fix-insteadof-url-mismatch

Conversation

@rajatvig
Copy link

Summary

  • Use git config --get remote.origin.url instead of git remote get-url origin to get the raw stored URL without insteadOf transformation
  • Prevents false URL mismatch detection and unnecessary fsck/gc runs when url.*.insteadOf is configured (e.g., to rewrite SSH to HTTPS for GitHub Apps auth)

Problem

When url.*.insteadOf is configured in gitconfig, git remote get-url returns the transformed URL, not the stored URL:

  • Stored URL: git@github.com:org/repo.git
  • git remote get-url returns: https://github.com/org/repo.git (due to insteadOf)
  • Pipeline requests: git@github.com:org/repo.git
  • Agent sees mismatch, runs fsck/gc unnecessarily

Test plan

  • go fmt ./... - no changes needed
  • go test ./internal/job/... - all tests pass

When url.*.insteadOf is configured in gitconfig (e.g., to rewrite SSH
to HTTPS for GitHub Apps auth), `git remote get-url` returns the
transformed URL, not the stored URL. This causes false URL mismatch
detection and unnecessary fsck/gc runs on every checkout.

Use `git config --get remote.origin.url` instead, which returns the
raw stored URL without insteadOf transformation.

Signed-off-by: Rajat Vig <rvig@etsy.com>
@rajatvig rajatvig force-pushed the fix-insteadof-url-mismatch branch from c4eff69 to 41bb1f7 Compare February 24, 2026 23:50
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c4eff69968

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Signed-off-by: Rajat Vig <rvig@etsy.com>
@rajatvig
Copy link
Author

@DrJosh9000 Cpuld you please when you have time recut the change? We're seeing increased times when using GitHub Apps to clone for large repositories

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.

2 participants