Skip to content
This repository was archived by the owner on Jul 30, 2026. It is now read-only.

Commit 04abcb5

Browse files
committed
fix(git): use Basic auth instead of Bearer for GitHub App tokens
GitHub's git HTTPS smart protocol requires HTTP Basic auth with x-access-token as the username, not Bearer tokens. Switch both authEnv() and cloneRepo() to use Authorization: Basic base64("x-access-token:<token>").
1 parent edb4357 commit 04abcb5

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/core/services/git.service.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ export class GitService {
1414

1515
private authEnv(): Record<string, string> {
1616
if (!this.token) return {};
17+
const encoded = Buffer.from(`x-access-token:${this.token}`).toString(
18+
"base64",
19+
);
1720
return {
1821
...process.env,
1922
GIT_CONFIG_COUNT: "1",
2023
GIT_CONFIG_KEY_0: "http.extraheader",
21-
GIT_CONFIG_VALUE_0: `Authorization: Bearer ${this.token}`,
24+
GIT_CONFIG_VALUE_0: `Authorization: Basic ${encoded}`,
2225
};
2326
}
2427

@@ -39,7 +42,10 @@ export class GitService {
3942
): Promise<void> {
4043
await $`rm -rf ${this.repoPath}`;
4144
const configArgs = this.token
42-
? ["-c", `http.extraheader=Authorization: Bearer ${this.token}`]
45+
? [
46+
"-c",
47+
`http.extraheader=Authorization: Basic ${Buffer.from(`x-access-token:${this.token}`).toString("base64")}`,
48+
]
4349
: [];
4450
if (bare) {
4551
await $`git ${configArgs} clone --bare ${repoUrl} ${this.repoPath}`;

0 commit comments

Comments
 (0)