From 1380eee9892e963cac5ca911e0b65a3ce861b14c Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 28 Sep 2026 16:52:20 +0200 Subject: [PATCH] updated --- src/git.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/git.js b/src/git.js index 05faa13..ff87380 100644 --- a/src/git.js +++ b/src/git.js @@ -6,12 +6,18 @@ import { run } from './exec.js'; export function gitAuthEnv(token, baseEnv = process.env) { + // Gitea's git-over-HTTP backend (unlike its REST API) does not accept the + // "Authorization: token " scheme — it wants HTTP Basic auth, username + // arbitrary, password/token as the credential. "oauth2" as the username + // is an arbitrary placeholder (matches the convention other git hosts + // use for token auth) — Gitea only checks the token in the password slot. + const basic = Buffer.from(`oauth2:${token}`).toString('base64'); return { ...baseEnv, GIT_TERMINAL_PROMPT: '0', GIT_CONFIG_COUNT: '1', GIT_CONFIG_KEY_0: 'http.extraHeader', - GIT_CONFIG_VALUE_0: `Authorization: token ${token}`, + GIT_CONFIG_VALUE_0: `Authorization: Basic ${basic}`, }; }