Make WordPress Core

Opened 26 hours ago

Last modified 15 hours ago

#65542 new defect (bug)

Contributor Handbook: Update `gh repo fork` example to work with the current GitHub CLI

Reported by: mkrndmane's profile mkrndmane Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Text Changes Keywords: has-patch has-screenshots has-test-info
Focuses: Cc:

Description

While setting up the WordPress development environment for the first time, I followed the Contributor Handbook instructions for forking the wordpress-develop repository.

The documentation currently recommends:

gh repo fork WordPress/wordpress-develop --clone --remote

Using GitHub CLI 2.94.0 (2026-06-10), this command returns:

the `--remote` flag is unsupported when a repository argument is provided

I then retried the setup using:

gh repo fork WordPress/wordpress-develop --clone

This completed successfully and performed the expected setup:

  • Forked the repository to my GitHub account.
  • Cloned the repository locally.
  • Added WordPress/wordpress-develop as the upstream remote.

Based on this behavior, the --remote flag appears to be unnecessary (or no longer supported) with the current GitHub CLI, while the documented outcome is still achieved.

Proposed change

Update the documentation to use:

gh repo fork WordPress/wordpress-develop --clone

instead of:

gh repo fork WordPress/wordpress-develop --clone --remote

This would help first-time contributors avoid the confusing error while following the setup instructions.

Environment

  • GitHub CLI: 2.94.0 (2026-06-10)
  • I will attach a screenshot of the error message & successful command.

Attachments (2)

Screenshot 2026-06-25 at 7.47.30 PM.png (212.2 KB) - added by mkrndmane 26 hours ago.
Error message for existing command
Screenshot 2026-06-25 at 7.47.46 PM.png (216.1 KB) - added by mkrndmane 26 hours ago.
Successful execution after removing --remote & can see upstream is added successfully

Download all attachments as: .zip

Change History (4)

This ticket was mentioned in PR #12321 on WordPress/wordpress-develop by @mkrndmane.


26 hours ago
#1

This PR updates the GitHub CLI example used when forking the wordpress-develop repository.

### Current command

gh repo fork WordPress/wordpress-develop --clone --remote

### Updated command

gh repo fork WordPress/wordpress-develop --clone

### Why?

While following the contributor documentation for the first time, I encountered the following error when running the documented command with GitHub CLI 2.94.0:

the `--remote` flag is unsupported when a repository argument is provided

Running the command without --remote successfully:

  • Forked the repository.
  • Cloned it locally.
  • Added the upstream remote as described in the documentation.

This update aligns the documentation with the current behavior of the GitHub CLI and helps prevent confusion for new contributors.

Fixes: https://core.trac.wordpress.org/ticket/65542

## Use of AI Tools

AI assistance: Yes

Tool(s): ChatGPT

Model(s): GPT-5.5

Used for: Drafting the Trac ticket and pull request description. I verified the issue, tested the commands locally, and reviewed the final content before submission.

@mkrndmane
26 hours ago

Error message for existing command

@mkrndmane
26 hours ago

Successful execution after removing --remote & can see upstream is added successfully

#2 @khokansardar
15 hours ago

  • Keywords has-test-info added

Patch testing report

Patch / PR tested

Note on test method
This is a documentation-only text change (README.md), so there is no runtime behaviour to reproduce in the browser. It was validated by confirming the GitHub CLI behaviour described in the ticket against the current gh source and gh repo fork --help.

Environment

OS: macOS 26.5.1
GitHub CLI (local): gh 2.90.0
Reporter's GitHub CLI: 2.94.0 (2026-06-10)
Repo: wordpress-develop trunk @ 87a5738363

Steps

  1. Reviewed README.md line 44 — currently documents gh repo fork WordPress/wordpress-develop --clone --remote.
  2. Checked gh repo fork --help and the GitHub CLI fork.go validation logic.
  3. Confirmed the error path for the documented command.
  4. Confirmed the updated command (--clone only) still produces the three outcomes the README lists (fork, clone, add upstream as default).

Results

  • Bug confirmed: gh repo fork <repo> --clone --remote fails. GitHub CLI's fork.go guards this: if opts.Repository != "" && cmd.Flags().Changed("remote") returns the exact error the reporter quoted — "the --remote flag is unsupported when a repository argument is provided".
  • Fix validated: with a repository argument, --clone automatically adds the upstream remote and sets it as the default repo, so --remote was always redundant here. Dropping it preserves the documented outcome exactly.
  • Docs accuracy: README lines 45–47 (fork to account / clone / add upstream and set default) remain fully accurate after the change. No other text needs updating.
  • Scope: diff is a single line in README.md, +1/-1. No code, no other files, no scope creep.

Conclusion
PR #12321 removes the unsupported --remote flag from the documented gh repo fork example in README.md. The documented command currently errors out on current GitHub CLI versions for first-time contributors; the updated command works and still yields the same fork/clone/upstream setup the README describes. The change is minimal, idiomatic, and scoped strictly to the ticket, with no backward-compatibility or performance implications. Recommend commit.

Note: See TracTickets for help on using tickets.