Skip to content

gh repo fork does not set the default push remote #3724

Open

Description

@gotmax23

Describe the bug

Please see ## Steps to reproduce the behavior.

> gh --version
gh version 1.10.3 (2021-05-21)
https://github.com/cli/cli/releases/tag/v1.10.3

Steps to reproduce the behavior

  1. Clone any repo. For this test, I cloned this repo with git repo clone cli/cli.
  2. Run gh repo fork --remote=true --clone=true (or git repo fork and select the equivalent of those arguments when prompted)
  3. Commit some changes and run git push.
  4. See error:

ERROR: Permission to cli/cli.git denied to $USER.
fatal: Could not read from remote repository

Expected vs actual behavior

When forking a repo, gh should set the default remote to the fork, at least in my opinion.

Obviously, you can just run git push -u origin trunk yourself, replacing trunk with the current branch, or just run git push -u origin --all; however, I think it would make sense for gh repo fork to preform this automatically or at least provide the option to do so.

Logs

N/A

Activity

  1. added
    bug
    on May 27, 2021
  2. mislav commented on May 27, 2021

    @mislav
    Contributor

    Thanks for the suggestion! The workflow you suggested makes sense.

    gh repo fork was never designed to automatically set push configuration for you, so I don't see this as a bug, but as an additional enhancement we can consider. I will reassign labels accordingly.

  3. added
    enhancement
    and removed
    bug
    on May 27, 2021
  4. added
    core
    on Jun 1, 2021
  5. vilmibm commented on Jun 1, 2021

    @vilmibm
    Contributor

    I like the idea of asking the user if they want us to run git push -u origin --all for them and a corresponding flag like... --reset-upstream or something?

  6. added
    gh-repo
    on Oct 2, 2023
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

    coreenhancementgh-repo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions