gh repo fork Make your own copy of someone else's repository

Creates a fork of a repository under your account. Used inside a clone, it also adds a remote for your fork so you can push there and open pull requests back.

Synopsis

gh repo fork [REPOSITORY] [FLAGS]

Common options

Option or formWhat it does
--cloneClone the fork afterwards
--remoteAdd a remote for the fork to the current repository
--remote-name NAMEName for that remote (default: origin)
--org NAMECreate the fork in an organisation
--fork-name NAMEGive the fork a different name
--default-branch-onlyCopy only the default branch

Examples

Fork and clone
gh repo fork octocat/Hello-World --clone
Fork the repository you are in
gh repo fork --remote
Fork into an organisation
gh repo fork octocat/Hello-World --org acme
Fork with only the main branch
gh repo fork octocat/Hello-World --default-branch-only --clone

Notes

See also

Last reviewed 2026-10-09.