Skip to content

Commit 056b349

Browse files
committed
fix(checkout): use git@github.com SSH URL for git clone
gh auth uses SSH protocol, not HTTPS. Changed: https://github.com/{repo}.git → git@github.com:{repo}.git Both clone commands (first attempt and retry) updated.
1 parent 0a32b3f commit 056b349

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

scripts/github-code-review.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,11 +1475,11 @@ function checkoutBranch(string $repo, string $branch, string $checkoutPath): str
14751475
// Use git clone directly (not gh repo clone) — gh repo clone creates
14761476
// incomplete clones where commit objects are missing from the pack file,
14771477
// causing "bad object HEAD" and "corrupt patch" errors during apply.
1478-
// We pass --depth 1 for faster clones since we only need the base branch.
1478+
// gh auth uses SSH, so use git@github.com: URL.
14791479
$cloneCmd = sprintf(
14801480
'git clone --depth 1 --branch %s -- %s %s 2>&1',
14811481
escapeshellarg($branch),
1482-
escapeshellarg("https://github.com/{$repo}.git"),
1482+
escapeshellarg("git@github.com:{$repo}.git"),
14831483
escapeshellarg($checkoutPath)
14841484
);
14851485

@@ -1526,7 +1526,7 @@ function checkoutBranch(string $repo, string $branch, string $checkoutPath): str
15261526
$cloneCmd = sprintf(
15271527
'git clone --depth 1 --branch %s -- %s %s 2>&1',
15281528
escapeshellarg($branch),
1529-
escapeshellarg("https://github.com/{$repo}.git"),
1529+
escapeshellarg("git@github.com:{$repo}.git"),
15301530
escapeshellarg($checkoutPath)
15311531
);
15321532
exec($cloneCmd, $cloneOutput, $cloneRet);

0 commit comments

Comments
 (0)