"opencode github install" is failing with an error about needing to be run in a git repo while in a git repo #947

Closed
opened 2026-02-16 17:28:53 -05:00 by yindo · 8 comments
Owner

Originally created by @bitfrost on GitHub (Jul 27, 2025).

Originally assigned to: @fwang on GitHub.

Image

Yes, a github repo (not just git) and logged in via the github-cli as well

Originally created by @bitfrost on GitHub (Jul 27, 2025). Originally assigned to: @fwang on GitHub. <img width="713" height="403" alt="Image" src="https://github.com/user-attachments/assets/20b061de-e321-4675-b19e-a39029a4f62d" /> Yes, a github repo (not just git) and logged in via the github-cli as well
yindo closed this issue 2026-02-16 17:28:53 -05:00
Author
Owner

@nivekithan commented on GitHub (Jul 28, 2025):

Facing same issue on Ubuntu

@nivekithan commented on GitHub (Jul 28, 2025): Facing same issue on Ubuntu
Author
Owner

@bitfrost commented on GitHub (Jul 28, 2025):

I think its bug with regex (2nd one) (repo I am testing on returns https://github.com blah from 'git remote get-url origin'

https://github.com/sst/opencode/blob/dev/packages/opencode/src/cli/cmd/github.ts#L188-L192

I will open a PR in a few

@bitfrost commented on GitHub (Jul 28, 2025): I think its bug with regex (2nd one) (repo I am testing on returns https://github.com blah from 'git remote get-url origin' https://github.com/sst/opencode/blob/dev/packages/opencode/src/cli/cmd/github.ts#L188-L192 I will open a PR in a few
Author
Owner

@bitfrost commented on GitHub (Jul 28, 2025):

https://github.com/sst/opencode/pull/1382/files

@bitfrost commented on GitHub (Jul 28, 2025): https://github.com/sst/opencode/pull/1382/files
Author
Owner

@bitfrost commented on GitHub (Jul 29, 2025):

https://github.com/sst/opencode/pull/1382/files

I misidentified the issue above, I have some repos who return an origin url that doesn't end .git (causing the no match on the 2nd regex). Resetting the origin to end with .git fixed the issue (but since its not required for github maybe this 2nd regex should be loosened)

I am not sure what in my workflow cause these repo's to end up like this. Could have an org rename I did a few days ago and me dropping the .git . @nivekithan is the repo you have this issue in also returning a url that doesn't end in ".git"
(git remote get-url origin)

Claude: "The .git suffix is technically the "canonical" format for Git repositories, but GitHub's infrastructure makes it optional for convenience."

@bitfrost commented on GitHub (Jul 29, 2025): > https://github.com/sst/opencode/pull/1382/files I misidentified the issue above, I have some repos who return an origin url that doesn't end .git (causing the no match on the 2nd regex). Resetting the origin to end with .git fixed the issue (but since its not required for github maybe this 2nd regex should be loosened) I am not sure what in my workflow cause these repo's to end up like this. Could have an org rename I did a few days ago and me dropping the .git . @nivekithan is the repo you have this issue in also returning a url that doesn't end in ".git" (git remote get-url origin) Claude: "The .git suffix is technically the "canonical" format for Git repositories, but GitHub's infrastructure makes it optional for convenience."
Author
Owner

@nivekithan commented on GitHub (Jul 30, 2025):

yep, I think that's the isssue too. I don't have .git suffix in the url with any of my repo. Once I added .git, opencode github install started working

@nivekithan commented on GitHub (Jul 30, 2025): yep, I think that's the isssue too. I don't have `.git` suffix in the url with any of my repo. Once I added `.git`, `opencode github install` started working
Author
Owner

@rekram1-node commented on GitHub (Aug 14, 2025):

found issue will fix

@rekram1-node commented on GitHub (Aug 14, 2025): found issue will fix
Author
Owner

@itahol commented on GitHub (Oct 7, 2025):

In my case it still doesn't work, I guess because I have a weird setup.

I'm on a work laptop, so for personal projects I have a separate folder and conditional gitconfig. I also had to configure it so checkouts from github.com-myName will use my config (had to, to make it work). I guess this screws up the regex.

@itahol commented on GitHub (Oct 7, 2025): In my case it still doesn't work, I guess because I have a weird setup. I'm on a work laptop, so for personal projects I have a separate folder and conditional gitconfig. I also had to configure it so checkouts from github.com-myName will use my config (had to, to make it work). I guess this screws up the regex.
Author
Owner

@sachyyn commented on GitHub (Dec 16, 2025):

This is still happening on 1.0.162

@sachyyn commented on GitHub (Dec 16, 2025): This is still happening on 1.0.162
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#947