{"meta":{"title":"Contributing to a project","intro":"Learn how to contribute to a project through forking.","product":"Get started","breadcrumbs":[{"href":"/en/enterprise-server@3.20/get-started","title":"Get started"},{"href":"/en/enterprise-server@3.20/get-started/exploring-projects-on-github","title":"Explore projects"},{"href":"/en/enterprise-server@3.20/get-started/exploring-projects-on-github/contributing-to-a-project","title":"Contribute to a project"}],"documentType":"article"},"body":"# Contributing to a project\n\nLearn how to contribute to a project through forking.\n\nContributing to a project on GitHub is an essential skill for developers and collaborators working together to achieve shared goals. Whether you're fixing bugs, adding features, or improving documentation, the process of contributing ensures structured and efficient collaboration.\n\nBy following the GitHub flow of forking repositories, creating branches, and submitting pull requests, you can propose changes to a project and get feedback without disrupting other people's work.\n\nThis guide provides instructions on contributing to a project using the GitHub UI and the command line. For more information on contributing with GitHub Desktop, see [Cloning and forking repositories from GitHub Desktop](/en/desktop/adding-and-cloning-repositories/cloning-and-forking-repositories-from-github-desktop). For the same with GitHub CLI (Command Line Interface), see [GitHub CLI quickstart](/en/enterprise-server@3.20/github-cli/github-cli/quickstart).\n\n## About forking\n\nIf you want to contribute to someone else's project but don’t have permission to make changes directly, you can create your own copy of the project, make updates, and then suggest those updates for inclusion in the main project. This process is often called a \"fork and pull request\" workflow.\n\nWhen you create your own copy (or \"fork\") of a project, it’s like making a new workspace that shares code with the original project. This is useful for open-source projects or anytime you don’t have write access to the original project.\n\nOnce you’ve made your changes in your copy, you can submit them as a pull request, which is a way to propose changes back to the main project. For more information, see [Fork a repository](/en/enterprise-server@3.20/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo).\n\n## Creating your own copy of a project\n\nThis tutorial uses [the Spoon-Knife project](https://github.com/octocat/Spoon-Knife), a test repository that's hosted on GitHub that lets you test the fork and pull request workflow.\n\n1. Navigate to the `Spoon-Knife` project at <https://github.com/octocat/Spoon-Knife>.\n2. In the top-right corner of the page, click **Fork**.\n\n   ![Screenshot of the main page of repository. A button, labeled with a fork icon and \"Fork 59.3k,\" is outlined in dark orange.](/assets/images/help/repository/fork-button.png)\n3. Under \"Owner,\" select the dropdown menu and click an owner for the forked repository.\n   > \\[!NOTE] If your username is grayed out, it's because the fork already exists. Instead, you should bring your existing fork up to date. For more information, see [Syncing a fork](/en/enterprise-server@3.20/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork#syncing-a-fork-branch-from-the-web-ui).\n4. By default, forks are named the same as their upstream repositories. Optionally, to further distinguish your fork, in the \"Repository name\" field, type a name.\n5. Optionally, in the \"Description\" field, type a description of your fork.\n6. Optionally, select **Copy the DEFAULT branch only**.\n\n   For many forking scenarios, such as contributing to open-source projects, you only need to copy the default branch. If you do not select this option, all branches will be copied into the new fork.\n7. Click **Create fork**.\n\n> \\[!NOTE]\n> If you want to copy additional branches from the upstream repository, you can do so from the **Branches** page. For more information, see [Creating and deleting branches within your repository](/en/enterprise-server@3.20/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository).\n\n## Cloning a fork to your computer\n\nYou've successfully forked the Spoon-Knife repository, but so far, it only exists on GitHub. To be able to work on the project, you will need to clone it to your computer.\n\nYou can clone your fork with the command line, GitHub CLI, or GitHub Desktop.\n\n1. On GitHub, navigate to **your fork** of the Spoon-Knife repository.\n\n2. Above the list of files, click **<svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-code\" aria-label=\"code\" role=\"img\"><path d=\"m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z\"></path></svg> Code**.\n\n   ![Screenshot of the list of files on the landing page of a repository. The \"Code\" button is highlighted with a dark orange outline.](/assets/images/help/repository/code-button.png)\n\n3. Copy the URL for the repository.\n\n   * To clone the repository using HTTPS, under \"HTTPS\", click <svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-copy\" aria-label=\"Copy to clipboard\" role=\"img\"><path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\"></path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\"></path></svg>.\n   * To clone the repository using an SSH key, including a certificate issued by your organization's SSH certificate authority, click **SSH**, then click <svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-copy\" aria-label=\"Copy to clipboard\" role=\"img\"><path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\"></path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\"></path></svg>.\n   * To clone a repository using GitHub CLI, click **GitHub CLI**, then click <svg version=\"1.1\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" class=\"octicon octicon-copy\" aria-label=\"Copy to clipboard\" role=\"img\"><path d=\"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z\"></path><path d=\"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z\"></path></svg>.\n\n     ![Screenshot of the \"Code\" dropdown menu. To the right of the HTTPS URL for the repository, a copy icon is outlined in dark orange.](/assets/images/help/repository/https-url-clone-cli.png)\n\n4. On Mac or Linux, open Terminal. On Windows, open Git Bash.\n\n5. Change the current working directory to the location where you want the cloned directory.\n\n6. Type `git clone`, and then paste the URL you copied earlier. It will look like this, with your GitHub username instead of `YOUR-USERNAME`:\n\n   ```shell\n   git clone https://HOSTNAME/YOUR-USERNAME/Spoon-Knife\n   ```\n\n7. Press **Enter**. Your local clone will be created.\n\n   ```shell\n   $ git clone https://HOSTNAME/YOUR-USERNAME/Spoon-Knife\n   > Cloning into `Spoon-Knife`...\n   > remote: Counting objects: 10, done.\n   > remote: Compressing objects: 100% (8/8), done.\n   > remove: Total 10 (delta 1), reused 10 (delta 1)\n   > Unpacking objects: 100% (10/10), done.\n   ```\n\n## Creating a branch to work on\n\nBefore making changes to the project, you should create a new branch and check it out. By keeping changes in their own branch, you follow GitHub flow and ensure that it will be easier to contribute to the same project again in the future. See [GitHub flow](/en/enterprise-server@3.20/get-started/using-github/github-flow#following-github-flow).\n\n```shell\ngit branch BRANCH-NAME\ngit checkout BRANCH-NAME\n```\n\n## Making and pushing changes\n\nGo ahead and make a few changes to the project using your favorite text editor, like [Visual Studio Code](https://code.visualstudio.com). You could, for example, change the text in `index.html` to add your GitHub username.\n\nWhen you're ready to submit your changes, stage and commit your changes. `git add .` tells Git that you want to include all of your changes in the next commit. `git commit` takes a snapshot of those changes.\n\n```shell\ngit add .\ngit commit -m \"a short description of the change\"\n```\n\nWhen you stage and commit files, you essentially tell Git, \"Take a snapshot of my changes.\" You can continue to make more changes and take more commit snapshots.\n\nRight now, your changes only exist locally. When you're ready to push your changes up to GitHub, push your changes to the remote.\n\n```shell\ngit push\n```\n\n## Making a pull request\n\nCreating a pull request is the final step in producing a fork of someone else's project. When you've made a beneficial change and want to propose it to the original repository, you'll create a pull request for a maintainer to review.\n\nTo do so, navigate to the repository on GitHub where your project lives. For this example, it would be at `https://github.com/<your_username>/Spoon-Knife`. You'll see a banner indicating that your branch is one commit ahead of `octocat:main`. Click **Contribute** and then **Open a pull request**.\n\nGitHub will bring you to a page that shows the differences between your fork and the `octocat/Spoon-Knife` repository. Click **Create pull request**.\n\nGitHub will bring you to a page where you can enter a title and a description of your changes. It's important to provide as much useful information and a rationale for why you're making this pull request in the first place. The project owner needs to be able to determine whether your change is as useful to everyone as you think it is. Finally, click **Create pull request**."}