Fork a repository - GitHub Docs (original) (raw)
A fork is a new repository that shares code and visibility settings with the original “upstream” repository.
About forks
A fork is a new repository that shares code and visibility settings with the original “upstream” repository. Forks are often used to iterate on ideas or changes before they are proposed back to the upstream repository, such as in open source projects or when a user does not have write access to the upstream repository. For more information, see Working with forks.
Propose changes to someone else's project
For example, you can use forks to propose changes related to fixing a bug. Rather than logging an issue for a bug you have found, you can:
- Fork the repository.
- Make the fix.
- Submit a pull request to the project owner.
Use someone else's project as a starting point for your own idea.
Open source software is based on the idea that by sharing code, we can make better, more reliable software. For more information, see the About the Open Source Initiative on the Open Source Initiative.
For more information about applying open source principles to your organization's development work on GitHub, see GitHub's white paper An introduction to innersource.
When creating your public repository from a fork of someone's project, make sure to include a license file that determines how you want your project to be shared with others. For more information, see Choose an open source license at choosealicense.com.
For more information on open source, specifically how to create and grow an open source project, we've created Open Source Guides that will help you foster a healthy open source community by recommending best practices for creating and maintaining repositories for your open source project. You can also take a free GitHub Skills course on maintaining open source communities.
Prerequisites
If you haven't yet, first set up Git and authentication with GitHub.com from Git. For more information, see Set up Git.
Forking a repository
Configuring Git to sync your fork with the upstream repository
When you fork a project in order to propose changes to the upstream repository, you can configure Git to pull changes from the upstream repository into the local clone of your fork.
Editing a fork
You can make any changes to a fork, including:
- Creating branches: Branches allow you to build new features or test out ideas without putting your main project at risk.
- Opening pull requests: If you want to contribute back to the upstream repository, you can send a request to the original author to pull your fork into their repository by submitting a pull request.
Find another repository to fork
Fork a repository to start contributing to a project. You can fork any public repository to your personal account, or to an organization where you have permission to create repositories. If you have access to a private repository and the owner permits forking, you can fork the repository to your personal account, or to an organization on GitHub Team where you have permission to create repositories. You cannot fork a private repository to an organization using GitHub Free. For more information about GitHub Team and GitHub Free, see GitHub’s plans. For more information about when you can fork a repository, see About permissions and visibility of forks.
You can browse Explore GitHub to find projects and start contributing to open source repositories. For more information, see Finding ways to contribute to open source on GitHub.
Next steps
You have now forked a repository, practiced cloning your fork, and configured an upstream repository.
- For more information about cloning the fork and syncing the changes in a forked repository from your computer, see Set up Git.
- You can also create a new repository where you can put all your projects and share the code on GitHub. Creating a repository for your project allows you to store code in GitHub. This provides a backup of your work that you can choose to share with other developers. For more information, see Quickstart for repositories.
- Each repository on GitHub is owned by a person or an organization. You can interact with the people, repositories, and organizations by connecting and following them on GitHub. For more information, see Finding inspiration on GitHub.
- GitHub has a great support community where you can ask for help and talk to people from around the world. Join the conversation on GitHub Community.