@@ -12,6 +12,9 @@ import { simpleGit, CheckRepoActions, type SimpleGit } from 'simple-git';
1212import type { Storage } from '../config/storage.js' ;
1313import { debugLogger } from '../utils/debugLogger.js' ;
1414
15+ export const SHADOW_REPO_AUTHOR_NAME = 'Gemini CLI' ;
16+ export const SHADOW_REPO_AUTHOR_EMAIL = 'gemini-cli@google.com' ;
17+
1518export class GitService {
1619 private projectRoot : string ;
1720 private storage : Storage ;
@@ -58,6 +61,13 @@ export class GitService {
5861 // Prevent git from using the user's global git config.
5962 GIT_CONFIG_GLOBAL : gitConfigPath ,
6063 GIT_CONFIG_SYSTEM : systemConfigPath ,
64+ // Explicitly provide identity to prevent "Author identity unknown" errors
65+ // inside sandboxed environments like Docker where the gitconfig might not
66+ // be picked up properly.
67+ GIT_AUTHOR_NAME : SHADOW_REPO_AUTHOR_NAME ,
68+ GIT_AUTHOR_EMAIL : SHADOW_REPO_AUTHOR_EMAIL ,
69+ GIT_COMMITTER_NAME : SHADOW_REPO_AUTHOR_NAME ,
70+ GIT_COMMITTER_EMAIL : SHADOW_REPO_AUTHOR_EMAIL ,
6171 } ;
6272 }
6373
@@ -73,8 +83,7 @@ export class GitService {
7383
7484 // We don't want to inherit the user's name, email, or gpg signing
7585 // preferences for the shadow repository, so we create a dedicated gitconfig.
76- const gitConfigContent =
77- '[user]\n name = Gemini CLI\n email = gemini-cli@google.com\n[commit]\n gpgsign = false\n' ;
86+ const gitConfigContent = `[user]\n name = ${ SHADOW_REPO_AUTHOR_NAME } \n email = ${ SHADOW_REPO_AUTHOR_EMAIL } \n[commit]\n gpgsign = false\n` ;
7887 await fs . writeFile ( gitConfigPath , gitConfigContent ) ;
7988
8089 const shadowRepoEnv = this . getShadowRepoEnv ( repoDir ) ;
0 commit comments