google-gemini/gemini-cli · error · Error
Failed to clone Git repository from ${installMetadata.source
Error message
Failed to clone Git repository from ${installMetadata.source} ${getErrorMessage(error)} What it means
Catch-all wrapper around the entire cloneFromGit try block. Any failure in clone, getRemotes, fetch, or checkout is re-thrown with the source and the underlying message (via getErrorMessage) and the original error attached as cause.
Source
Thrown at packages/cli/src/config/extensions/github.ts:73
}
await git.clone(sourceUrl, './', ['--depth', '1']);
const remotes = await git.getRemotes(true);
if (remotes.length === 0) {
throw new Error(
`Unable to find any remotes for repo ${installMetadata.source}`,
);
}
const refToFetch = installMetadata.ref || 'HEAD';
await git.fetch(remotes[0].name, refToFetch);
// After fetching, checkout FETCH_HEAD to get the content of the fetched ref.
// This results in a detached HEAD state, which is fine for this purpose.
await git.checkout('FETCH_HEAD');
} catch (error) {
throw new Error(
`Failed to clone Git repository from ${installMetadata.source} ${getErrorMessage(error)}`,
{
cause: error,
},
);
}
}
export interface GithubRepoInfo {
owner: string;
repo: string;
}
export function tryParseGithubUrl(source: string): GithubRepoInfo | null {
// Handle SCP-style SSH URLs.
if (source.startsWith('git@')) {
if (source.startsWith('git@github.com:')) {
// It's a GitHub SSH URL, so normalize it for the URL parser.View on GitHub (pinned to 5024443c72)
Solutions
- Inspect error.cause for the real git failure and address it (fix URL, refresh token, correct ref).
- Confirm network/proxy access to the git host and that the destination is writable.
- Retry after fixing credentials; for transient failures, retry with backoff.
Example fix
// before
try { await cloneFromGit(meta, dest); }
catch (e) { /* only sees wrapped message */ }
// after
try { await cloneFromGit(meta, dest); }
catch (e) {
if (e.cause) console.error('underlying git error:', e.cause);
throw e;
} Defensive patterns
Strategy: try-catch
Try / catch
try { await cloneFromGit(meta, dest); } catch (e) { const cause = (e as Error & {cause?: Error}).cause; logGitFailure(meta.source, cause ?? e); throw e; } Prevention
- Check error.cause for the underlying git message before reporting.
- Verify token, URL, and ref before invoking clone in automation.
When it happens
Trigger: git.clone rejects (auth failure, unreachable host, invalid URL, permission denied on destination), git.fetch rejects (ref does not exist), or git.checkout('FETCH_HEAD') rejects (fetch produced nothing).
Common situations: Wrong/expired GitHub token; typo'd source URL; branch/tag in installMetadata.ref that does not exist; destination directory not writable; corporate proxy blocking git; rate-limited by the hoster.
Related errors
- Unable to find any remotes for repo ${installMetadata.source
- Updated extension not found after installation, got error:\n
- Installing extensions from remote sources is disallowed by y
- Failed to install extension ${installMetadata.source}: ${res
- Invalid repo URL: ${source}
AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12).
Data as JSON: /api/errors/f0f9cadb95c0f258.
Report an issue: GitHub.