Skip to content

repo set-default feedback #6804

Closed
Closed

Description

@samcoe

Thanks for addressing #2090! I think the solution is great in terms of behavior, but perhaps the nomenclature could be better. In particular, as @mislav said here, referring to a "default repository" (which is implied by the command gh repo set-default is ambiguous. It would be clearer if the subcommand was e.g. git repo set-default-remote.

I also don't think the reference to "this directory" is an intuitive nomenclature. I tend to think of the directory containing a git repository as "the local repository", not as a generic directory. So I'd also suggest changing the phrasing in:

Short: "Configure default repository for this directory",

fmt.Fprintf(opts.IO.Out, "%s Set %s as the default repository for the current directory\n", cs.SuccessIcon(), ghrepo.FullName(selectedRepo))

"%s No default remote repository has been set for this directory.\n",

...to say e.g. "default remote for this repository".

Originally posted by @waldyrious in #6777 (comment)

Activity

  1. added
    discuss
    on Jan 3, 2023
  2. waldyrious commented on Jan 4, 2023

    @waldyrious
    Contributor

    For the record, I commented in #6777 instead of in an existing or new issue because that is what @mislav suggested here. I do feel it is a bit awkward to use release discussions to have discussions about specific topics (other than, say, meta discussion about the release itself). Thanks for opening a dedicated thread for this discussion!

  3. samcoe commented on Jan 4, 2023

    @samcoe
    ContributorAuthor

    @waldyrious Yup, I purposefully turned your discussion comment into a new issue as I felt it was warranted and wanted to discuss it internally with the team. We use the "discuss" label to indicate that, but labels are not available in discussions.

  4. mislav commented on Jan 10, 2023

    @mislav
    Contributor

    Thanks for the feedback!

    We discussed this a bit and we're in agreement that changing the language in the documentation, error messages, and gh repo set-default command output to say “default (git) remote” instead of “default repository” is a good idea in order to reduce ambiguity. However, we wouldn't rename the command right now because it just shipped and because we don't think a longer, more verbose name will necessarily translate into better user experience.

  5. added
    help wanted
    and removed
    discuss
    on Jan 10, 2023
  6. waldyrious commented on Jan 10, 2023

    @waldyrious
    Contributor

    Fair enough. Changing the messaging and documentation is already a good improvement. Would you be open to change the command name some versions down the road?

  7. mislav commented on Jan 10, 2023

    @mislav
    Contributor

    We're open to make absolutely any change to gh down the line provided there are strong enough reasons to do so. For now, we want to first see how gh repo set-default pans out, and we don't have evidence that a rename would be a significant improvement.

  8. waldyrious commented on Jan 24, 2023

    @waldyrious
    Contributor

    By the way, I just noticed that you mentioned that there is agreement about changing "default repository" → "default remote", but not about changing "for this directory" → "for this repository". Can you please clarify?

    An alternative phrasing for the latter could be "for this clone", if "for this repository" is considered too ambiguous (since there could be multiple local clones of the same repository).

  9. SamB commented on Sep 18, 2023

    @SamB

    It's also not clear whether to set this to your fork or to your upstream repository.

  10. added
    gh-repo
    on Oct 3, 2023
  11. williammartin commented on Oct 3, 2023

    @williammartin
    Member

    @SamB, thanks for the feedback. What do you think would help you in deciding that beyond the help text that is already there?

    This command sets the default remote repository to use when querying the
    GitHub API for the locally cloned repository.
    
    gh uses the default repository for things like:
    
     - viewing and creating pull requests
     - viewing and creating issues
     - viewing and creating releases
     - working with Actions
     - adding repository and environment secrets
    
  12. maxandersen commented on Jan 19, 2024

    @maxandersen

    coming from #7755 I just wanna say that I would love being able to tell gh that if nothing else set then use origin as the default repo (I know others prefer upstream).

  13. added
    help wanted candidate
    and removed
    help wanted
    on Jul 27, 2025
  14. added
    core
    and removed
    help wanted candidate
    on Jan 19, 2026
  15. BagToad commented on Jan 21, 2026

    @BagToad
    Member

    Hey folks 👋

    We've been going through the help wanted candidates in our backlog. This is an old issue that doesn't have a clear enough path forward for implementation, so @babakks and I read through this to distill some of the feedback here into something more actionable and created #12514. I'll close this one out in favour of that new issue 🙏

  16. waldyrious commented on Sep 3, 2026

    @waldyrious
    Contributor

    I would love being able to tell gh that if nothing else set then use origin as the default repo (I know others prefer upstream).

    You can actually do as @minrk suggested in #6827:

    add to ~/.gitconfig:

    [remote "origin"]
        gh-resolved = base
    

    That way, the "origin" remote will always be considered the default/base repository for PRs, browsing, etc.

    Beware that doing so will prevent overriding the config for specific repos via gh itself, due to #7770; however, such overrides can be added manually via git itself, e.g. git config remote.upstream.gh-resolved base, to set "upstream" as the default/base remote for the current repo.

  17. maxandersen commented on Sep 26, 2026

    @maxandersen

    I'm late for this but Thank you @waldyrious !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coredocsgh-repo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions