stalecontext/forgejo-cli-plus
2
4
Fork
You've already forked forgejo-cli-plus
1

Auto-detection fails with multiple remotes when branch has no upstream #44

Closed
opened 2026年03月31日 02:06:23 +02:00 by stalecontext · 0 comments

Bug

When a git repo has multiple remotes (e.g., origin + upstream) and the current branch does not track a remote branch, fj errors with:

Error: no repo info specified
If you're trying to operate on a repository in the current directory, try adding a remote
referencing the forgejo instance. If you have multiple remotes, try setting one as upstream to the
current branch. You may also specify a host explicitly using the `--host` argument.

Steps to reproduce

git remote add upstream https://codeberg.org/forgejo-contrib/forgejo-cli.git
git checkout -b new-branch # no upstream tracking
fj issue view 1 # Error: no repo info specified

Expected behavior

fj should fall back to the origin remote when:

  1. Multiple remotes exist
  2. The current branch doesn't track any remote
  3. No --remote or --host was specified

This matches the convention used by git push, gh, and other CLI tools that treat origin as the default remote.

Workaround

Pass --remote origin explicitly:

fj issue view 1 --remote origin

Location

The fallback chain is in src/repo.rs in RepoInfo::get_current(). After checking for a single remote and branch tracking, there is no origin fallback before the error path.

## Bug When a git repo has multiple remotes (e.g., `origin` + `upstream`) and the current branch does not track a remote branch, `fj` errors with: ``` Error: no repo info specified If you're trying to operate on a repository in the current directory, try adding a remote referencing the forgejo instance. If you have multiple remotes, try setting one as upstream to the current branch. You may also specify a host explicitly using the `--host` argument. ``` ### Steps to reproduce ```sh git remote add upstream https://codeberg.org/forgejo-contrib/forgejo-cli.git git checkout -b new-branch # no upstream tracking fj issue view 1 # Error: no repo info specified ``` ### Expected behavior `fj` should fall back to the `origin` remote when: 1. Multiple remotes exist 2. The current branch doesn't track any remote 3. No `--remote` or `--host` was specified This matches the convention used by `git push`, `gh`, and other CLI tools that treat `origin` as the default remote. ### Workaround Pass `--remote origin` explicitly: ```sh fj issue view 1 --remote origin ``` ### Location The fallback chain is in `src/repo.rs` in `RepoInfo::get_current()`. After checking for a single remote and branch tracking, there is no `origin` fallback before the error path.
Sign in to join this conversation.
No Branch/Tag specified
main
feature/issue-batch-2026-07
upstream-sync/2026-07-02
feat/repo-create-org
projects
v2.0.0
upstream-reviewed/2026-07-02
v1.1.0
upstream-reviewed/2026-03-31
v1.0.0
upstream-reviewed/2026-03-16
v0.4.0
v0.3.0
v0.2.0
v0.1.1
v0.1.0
v0.0.4
v0.0.3
v0.0.2
v0.0.1
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
stalecontext/forgejo-cli-plus#44
Reference in a new issue
stalecontext/forgejo-cli-plus
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?