google-gemini / google-gemini/gemini-cli

bug: GitHub repo parsing strips '.git' anywhere in the name (blog.github.io -> hub.io)

Open Beginner friendly
#29,037 2 comments 0 reactions 0 assignees View on GitHub
area/extensions effort/small status/bot-triaged
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

## What happened?

GitHub repo parsing strips the `.git` suffix with `String.prototype.replace('.git', '')`, which removes the **first occurrence anywhere** in the string, not a suffix. Any repository whose name merely *contains* `.git` is mangled, producing wrong API URLs for releases/install/update.

## Affected code

`packages/cli/src/config/extensions/github.ts:128`:

```ts
const owner = parts[0];
const repo = parts[1].replace('.git', '');
```

## How can this be reproduced?

```console
$ gemini extensions install https://github.com/someuser/blog.github.io
```

Parsing yields `repo = "hub.io"` (`"blog.github.io".replace('.git', '')` removes the first `.git`, which is the one inside `github.`). All subsequent calls hit `/repos/someuser/hub.io/releases/latest` → 404. Additionally, `getExtensionId()` derives its dedup id from this corrupted repo name, so even after a manual fix the extension identity stays wrong in settings/state.

## What did you expect to happen?

Only a *trailing* `.git` should be removed: `parts[1].replace(/\.git$/, '')`.

## Impact

Release-based install/update is broken for any repo whose name contains `.git` as a substring (common pattern: `*.github.io` pages repos, `gitfoo` tools).

## Suggested direction

Anchor the strip to the end: `.replace(/\.git$/i, '')`. Add unit tests for `blog.github.io`, `my.git.repo`, `repo.git`.

---

*Found by source audit on current `main` (commit `5411f113c`); platform-independent. No open issue/PR covering this was found (searched: repo name .git github parsing).*

Contributor guide

Open the contributing guide

Research direction

Start in packages/cli/src/config/extensions/github.ts at line 128 and trace getExtensionId() to see how the parsed repository name is used for API URLs and extension state. Add coverage for blog.github.io, my.git.repo, and repo.git, then run the relevant unit tests. Done means only a trailing .git is removed and repository URLs and extension identities retain the correct name.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, typescript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.