Skip to content

Fix false URL mismatch detection with insteadOf#3718

Merged
CerealBoy merged 2 commits intobuildkite:mainfrom
rajatvig:fix-insteadof-url-mismatch
Mar 3, 2026
Merged

Fix false URL mismatch detection with insteadOf#3718
CerealBoy merged 2 commits intobuildkite:mainfrom
rajatvig:fix-insteadof-url-mismatch

Conversation

@rajatvig
Copy link
Contributor

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
Contributor 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

Copy link
Member

@CerealBoy CerealBoy left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you very much for the contribution @rajatvig, we'll aim to cut a new release in the next day or two.

@CerealBoy CerealBoy merged commit e4b867a into buildkite:main Mar 3, 2026
2 checks passed
@CerealBoy
Copy link
Member

Hi @rajatvig 👋🏼

We've just released v3.119.0 that includes this change if you'd like to upgrade to it now.

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