GIT-FORK(1)
π GIT-FORK(1) β or, how to stealβ no wait, fork π
okay bestie, sit down, hydrate, because we're talking about git-fork from the Git Extras collection and it's genuinely one of my faves. manual section 1, main character energy, no cap. π
β¨ NAME β¨
git-fork β Fork a repo on github π΄
πΈ SYNOPSIS πΈ
git-fork [<github-repo-url>]
that's it. one optional lil argument. we love a minimal interface. π
π¦ DESCRIPTION π¦
okay so here's the tea. If a github repo url is given, fork the repo. it's like clone but it forks first. so unserious of it but also so iconic.
- forks the repo on github
- clones the repo into the current dir
- adds the original repo as a remote called
upstream
and if a url is not given and the current dir is a github repo, fork the repo. yes queen, it just figures it out from where you're standing.
- forks the current repo
- rename the
originremote repo toupstream - adds the forked repo as a remote called
origin
now, about the remotes: Remotes will use ssh if you have it configured with GitHub, if not, https will be used. so if you've done the ssh key setup, you get the pretty version. if not, it still works, don't stress. π«Ά
tl;dr β Create a fork of a project on GitHub via command line. that's the whole vibe.
β οΈ okay important, do NOT skip this: A personal access token is required for making the API call to create a fork in GitHub. like, required required. no token, no fork, it's giving locked door.
API Documentation here https://docs.github.com/en/rest/reference/repos#forks π₯
also!! Make sure the personal access token has the right OAuth scopes for the repo(s). a token with the wrong scopes is just a decorative little string, bestie. π
okay so how do you feed it the token:
- Use the
GITHUB_TOKENenvironment variable, or - run
git config --global --add git-extras.github-personal-access-token <your-personal-access-token>
and if you're out here living that multiple accounts life (we see you, alt era π), override the global value in the specific repo using:
git config git-extras.github-personal-access-token <other-acc-personal-access-token>
per-repo override. genius. obsessed. π
π EXAMPLE π
Fork expect.js:
$ git fork https://github.com/LearnBoost/expect.js
or just:
$ git fork LearnBoost/expect.js
Then:
$ ..<forks into your github profile and clones repo locally to expect.js dir>...
$ cd expect.js && git remote -v
origin git@github.com:<user>/expect.js (fetch)
origin git@github.com:<user>/expect.js (push)
upstream git@github.com:LearnBoost/expect.js (fetch)
upstream git@github.com:LearnBoost/expect.js (push)
look at those remotes. origin is you, upstream is them. so clean, so organized, a whole system π
and If the current dir is a clone of expect.js, this has the same effect:
$ git fork
no args, no url, just vibes. it knows. β¨
π AUTHOR π
Written by Andrew Griffiths <mail@andrewgriffithsonline.com> β thank you king, this tool ate π
π REPORTING BUGS π
found a bug?? not me manifesting it, but if you did:
https://github.com/tj/git-extras/issues
go tell them, they're nice about it fr fr π«Ά
π SEE ALSO π
https://github.com/tj/git-extras
the whole Git Extras cinematic universe lives there. go explore. iykyk π
later bestie β this was GIT-FORK(1) from Git Extras, dated May 2026. go fork something cute, stay hydrated, and remember your token scopes. mwah π
π¦ where this page comes from
- ubuntu stonking: git-extras 7.5.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms