{"record":{"id":"44066fbb1b3799fd","repo":"google-gemini/gemini-cli","slug":"unable-to-determine-the-github-repository-setup","errorCode":null,"errorMessage":"Unable to determine the GitHub repository. /setup-github must be run from a git repository.","messagePattern":"Unable to determine the GitHub repository\\. /setup-github must be run from a git repository\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/ui/commands/setupGithubCommand.ts","lineNumber":219,"sourceCode":"        });\n      }),\n    );\n  } catch (error) {\n    debugLogger.debug('Failed to download required setup files: ', error);\n    throw error;\n  }\n}\n\nexport const setupGithubCommand: SlashCommand = {\n  name: 'setup-github',\n  description: 'Set up GitHub Actions',\n  kind: CommandKind.BUILT_IN,\n  autoExecute: true,\n  action: async (\n    context: CommandContext,\n  ): Promise<SlashCommandActionReturn> => {\n    if (!isGitHubRepository()) {\n      throw new Error(\n        'Unable to determine the GitHub repository. /setup-github must be run from a git repository.',\n      );\n    }\n\n    // Find the root directory of the repo\n    let gitRepoRoot: string;\n    try {\n      gitRepoRoot = getGitRepoRoot();\n    } catch (error) {\n      debugLogger.debug(`Failed to get git repo root:`, error);\n      throw new Error(\n        'Unable to determine the GitHub repository. /setup-github must be run from a git repository.',\n      );\n    }\n\n    // Get the latest release tag from GitHub\n    const proxy = context?.services?.agentContext?.config.getProxy();\n    const releaseTag = await getLatestGitHubRelease(proxy);","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/ui/commands/setupGithubCommand.ts#L201-L237","documentation":"Thrown at the start of /setup-github when isGitHubRepository() returns false. That helper runs `git remote -v` and tests for 'github.com'; if git is missing, not a repo, or the remote is not GitHub (GitLab/Bitbucket/etc.), it returns false and this error fires.","triggerScenarios":"isGitHubRepository() returns false because: not inside a git repo (git remote -v fails), or the configured remotes do not contain github.com.","commonSituations":"Running /setup-github outside any git repo; inside a repo whose remote points to a non-GitHub host; a freshly cloned repo where the remote was changed/removed; git not installed so the execSync throws and is caught as false.","solutions":["Run /setup-github from inside a git working tree (`git init` if needed).","Ensure the repo has a remote pointing at github.com (verify with `git remote -v`).","Install git and ensure it is on PATH if `git remote -v` currently fails.","If your project is hosted elsewhere, /setup-github is GitHub-specific and not applicable."],"exampleFix":"# before — no remote\nmkdir proj && cd proj && git init\ngemini  # /setup-github -> error\n# after\ngit remote add origin https://github.com/user/proj.git\ngemini  # /setup-github works","handlingStrategy":"validation","validationCode":"import { execSync } from 'node:child_process';\nfunction isGithubCwd(): boolean {\n  try {\n    return /github\\.com/.test(execSync('git remote -v', { encoding: 'utf-8' }) || '');\n  } catch { return false; }\n}\nif (!isGithubCwd()) throw new Error('Run /setup-github inside a GitHub git repo');","typeGuard":"function isGitHubRepository(): boolean {\n  try { return /github\\.com/.test(execSync('git remote -v', { encoding: 'utf-8' }) || ''); }\n  catch { return false; }\n}","tryCatchPattern":"try {\n  await runSetupGithub(ctx);\n} catch (e) {\n  if (e instanceof Error && /must be run from a git repository/.test(e.message)) {\n    // ensure cwd is a git repo with a github.com remote, then retry\n  }\n  throw e;\n}","preventionTips":["Run /setup-github only inside a git repo whose remote points to github.com.","Verify with `git remote -v` before invoking the command.","Install git and ensure it is on PATH so remote detection works."],"tags":["setup-github","git","github","repository","configuration"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}