fork
A copy of someone else's repository made on a hosting service such as GitHub, under your own account, so you can push to it.
In more detail
Forking is a feature of hosting services, not a git command. You fork when you cannot push to the original, clone your fork, push to it, and then open a pull request asking the original project to take your changes. The original is usually added as a second remote called upstream.
Examples
Workflows triggered by a pull request from a fork get no secrets and a read-only token; never run fork code on a self-hosted runner or under pull_request_target.OpenTofu was forked from Terraform 1.5.x, the last release under the Mozilla Public License.In Terraform: On GitHub a fork is usually a personal copy used to propose changes back. A project fork goes further: a new community takes the code in a different direction under its own name and governance. OpenTofu is a project fork of Terraform, taken from the last open source release.Related terms
- pull request — A request on a hosting service such as GitHub to merge one branch into another, with a page for review, discussion and automated checks.
- pull_request_target — A pull request event that runs the base repository's workflow with its secrets and a write-capable token, even for pull requests from forks.
- self-hosted runner — A runner you install and operate on your own hardware or cloud machine, selected with the self-hosted label.
- git clone — The command that copies an entire repository, every commit and branch, from a remote to a new folder on your machine.
- GitHub — A hosting service for Git repositories that adds collaboration features such as pull requests, issues, forks and releases.
- upstream branch — The remote branch your local branch is linked to, which git push, git pull and git status use when you do not name one.
- OpenTofu — The open source fork of Terraform, created in 2023 after the licence change and governed by a foundation rather than one company.
- open source — Software whose source code is published under a licence that lets anyone read, change and share it.
- repository — A project folder whose full history is tracked by version control; in Git, your files plus the hidden .git directory that stores every commit.
Taught in
- Runners: Where Code Executes — Continuous Integration & Continuous Delivery Pipelines
- Triggers and the Event Model — Continuous Integration & Continuous Delivery Pipelines
- Speeding Up Builds: Caching Dependencies — Continuous Integration & Continuous Delivery Pipelines
- Securing Pipelines: Secrets Management — Continuous Integration & Continuous Delivery Pipelines
- Merging: Fast Forward Or A Merge Commit — Advanced Git Internals & Distributed Workflows
- Rebase: The Same Work, A Different History — Advanced Git Internals & Distributed Workflows
- What A Remote Actually Is — Advanced Git Internals & Distributed Workflows
- Clone, Forks, Push, And The Upstream Branch — Advanced Git Internals & Distributed Workflows
- The Workflow That Ran On A Stranger's Pull Request — GitHub Actions (GH-200) Exam Prep
- Workflow Templates: Sharing Workflows Across An Organization — GitHub Actions (GH-200) Exam Prep
- Governing Actions: Allow Lists, SHA Pinning And Rulesets — GitHub Actions (GH-200) Exam Prep
- GitHub-Hosted And Larger Runners: Specs, Software And Networks — GitHub Actions (GH-200) Exam Prep
- Secrets And Variables By Scope: Precedence, Access And The REST API — GitHub Actions (GH-200) Exam Prep
- Usage, Billing And The Audit Log — GitHub Actions (GH-200) Exam Prep
- GITHUB_TOKEN: Least Privilege, Job By Job — GitHub Actions (GH-200) Exam Prep
- Script Injection: When An Issue Title Becomes Code — GitHub Actions (GH-200) Exam Prep
- OIDC: Cloud Access Without Stored Keys — GitHub Actions (GH-200) Exam Prep
- Supply Chain: Pinning, Trusted Actions And Attestations — GitHub Actions (GH-200) Exam Prep
- Faster And Cheaper: Where The Minutes Go — GitHub Actions (GH-200) Exam Prep
- Full Mock And Review: Where Your Points Go — GitHub Actions (GH-200) Exam Prep
- The Licence, OpenTofu And IBM — Infrastructure as Code with Terraform
- VCS, CLI And API Workflows: Speculative Plans And Run Triggers — HashiCorp Terraform Associate (004) Exam Prep