Skip to content

1.10.3 regression: Remote set for gh pr checkout is always readonly #3711

@xhochy

Description

@xhochy

Describe the bug

In previous versions, one could work with gh pr checkout <num> && <do changes> && git push on pull requests where the maintainer checkbox was set. With the latest release, this is no longer possible as the remote always gets set to upstream and the merge target(?) to refs/pull/?/head. Thus leading to the errors of the following style:

…
To github.com:conda-forge/lief-feedstock.git
 ! [remote rejected] HEAD -> refs/pull/22/head (deny updating a hidden ref)
error: failed to push some refs to 'github.com:conda-forge/lief-feedstock.git'

The only change I see in the commit history that could be related to this is #3663.

Steps to reproduce the behavior

See the description above.

Expected vs actual behavior

Expected output would be a successful push but we get the above snippet as an error.

In my case, one can see the change in difference between the following two PRs:

# cat .git/config
…
[branch "0.11.3_had13d6"]
	remote = git@github.com:regro-cf-autotick-bot/lief-feedstock.git
	merge = refs/heads/0.11.3_had13d6
[branch "0.11.5_h9b1896"]
	remote = upstream
	merge = refs/pull/22/head

The first was created with a previous gh version whereas the latter using 1.10.3. They are both PRs from the same fork to which I should be able to push. Changing the remote here leads to a successful push.

Logs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions