GH-REPO-FORK(1)
π΄ gh-repo-fork β the GitHub CLI manual, bestie edition
okay so this is gh-repo-fork, from the GitHub CLI manual (that's the <kbd>1</kbd> situation, it's a command page π
). It's the one that makes you a whole fork of a repo, and honestly? iconic behavior. Let's get into it.
β¨ SYNOPSIS β¨
gh repo fork [<repository>] [-- <gitflags>...] [flags]
Like, that's the whole shape of it: optional repo name, optional extra git flags after a --, and then your flags. Slay.
π DESCRIPTION π
Create a fork of a repository. Simple as that, no cap.
- Give it no argument and it creates a fork of the current repository β like, the one you're standing in. main character energy.
- Give it a
<repository>and it forks that specified repository instead.
By default, the new fork gets set as your origin remote, and any existing origin remote gets renamed to upstream. Yeah, it just does a little rename behind your back (lovingly). If you're not about that life, you can set a name for the new fork's remote with --remote-name.
The upstream remote will be set as the default remote repository. periodt.
And if you're feeling extra, additional git clone flags can be passed after --. π«Ά
π OPTIONS π
--cloneβ Clone the fork. Like, actually grab it locally.--default-branch-onlyβ Only include the default branch in the fork. Keep it minimal, keep it cute.--fork-name <string>β Rename the forked repository. Glow-up for your fork's name.--org <string>β Create the fork in an organization.--remoteβ Add a git remote for the fork.--remote-name <string>(default"origin") β Specify the name for the new remote.
π₯ EXIT CODES π₯
okay bestie, here's your vibe check on how this thing bounces:
0: Successful execution β¨1: Error π2: Command canceled (you hit the brakes, valid)4: Authentication required π
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information. iykyk.
πΈ EXAMPLE πΈ
# Fork a repository
$ gh repo fork owner/repo
# Fork a repository and clone it locally
$ gh repo fork owner/repo --clone
# Fork a repository without cloning it, skip the prompt
$ gh repo fork owner/repo --clone=false
See that last one? --clone=false is the sneaky little "no thank you, don't ask me" move. obsessed. π¦
π SEE ALSO π
gh-repo(1)β the rest of the repo family, go say hi
okay that's the whole page, mwah π β this lil masterpiece is GitHub CLI v2.102.0, dated Oct 2026, and it's the GH-REPO-FORK(1) page so you know exactly where you are. go forth and fork responsibly, bestie πβ
π¦ where this page comes from
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms