diff --git a/backend/src/services/git-operations.ts b/backend/src/services/git-operations.ts index 94aef729..bb8564f8 100644 --- a/backend/src/services/git-operations.ts +++ b/backend/src/services/git-operations.ts @@ -22,7 +22,7 @@ function getGitEnvironment(database: Database): Record { if (gitToken) { return { GITHUB_TOKEN: gitToken, - GIT_ASKPASS: 'echo', + GIT_ASKPASS: 'echo $GITHUB_TOKEN', GIT_TERMINAL_PROMPT: '0' } } diff --git a/backend/src/services/opencode-single-server.ts b/backend/src/services/opencode-single-server.ts index d6de8ea6..8b1ce6c2 100644 --- a/backend/src/services/opencode-single-server.ts +++ b/backend/src/services/opencode-single-server.ts @@ -99,7 +99,7 @@ class OpenCodeServerManager { XDG_DATA_HOME: path.join(OPENCODE_SERVER_DIRECTORY, '.opencode/state'), OPENCODE_CONFIG: OPENCODE_CONFIG_PATH, GITHUB_TOKEN: gitToken, - GIT_ASKPASS: 'echo', + GIT_ASKPASS: gitToken ? 'echo $GITHUB_TOKEN' : 'echo', GIT_TERMINAL_PROMPT: '0' } } diff --git a/backend/src/services/repo.ts b/backend/src/services/repo.ts index 772c1221..9d41e87c 100644 --- a/backend/src/services/repo.ts +++ b/backend/src/services/repo.ts @@ -17,12 +17,7 @@ async function hasCommits(repoPath: string): Promise { } } -function getAuthenticatedUrl(repoUrl: string, gitToken: string): string { - if (gitToken && repoUrl.startsWith('https://github.com')) { - return repoUrl.replace('https://', `https://${gitToken}@`) - } - return repoUrl -} + async function safeGetCurrentBranch(repoPath: string): Promise { try { @@ -88,7 +83,7 @@ export async function initLocalRepo( const env: Record = gitToken ? { GITHUB_TOKEN: gitToken, - GIT_ASKPASS: 'echo', + GIT_ASKPASS: 'echo $GITHUB_TOKEN', GIT_TERMINAL_PROMPT: '0' } : { GIT_ASKPASS: 'echo', GIT_TERMINAL_PROMPT: '0' } @@ -176,7 +171,7 @@ export async function cloneRepo( const settings = settingsService.getSettings('default') const gitToken = settings.preferences.gitToken - const cloneUrl = getAuthenticatedUrl(repoUrl, gitToken || '') + const cloneUrl = repoUrl if (shouldUseWorktree) { logger.info(`Creating worktree for branch: ${branch}`)