Skip to main content

This version of GitHub Enterprise Server was discontinued on 2023-09-25. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise Server. For help with the upgrade, contact GitHub Enterprise support.

Cloning and forking repositories from GitHub Desktop

You can use GitHub Desktop to clone and fork repositories that exist on GitHub.

Platform navigation

About local repositories

Repositories on GitHub are remote repositories. You can clone or fork a repository with GitHub Desktop to create a local repository on your computer.

You can create a local copy of any repository on GitHub Enterprise Server that you have access to by cloning the repository. If you own a repository or have write permissions, you can sync between the local and remote locations. For more information, see "Syncing your branch in GitHub Desktop."

When you clone a repository, any changes you push to GitHub Enterprise Server will affect the original repository. To make changes without affecting the original project, you can create a separate copy by forking the repository. You can create a pull request to propose that maintainers incorporate the changes in your fork into the original upstream repository. For more information, see "About forks."

When you try to use GitHub Desktop to clone a repository that you do not have write access to, GitHub Desktop will prompt you to create a fork automatically. You can choose to use your fork to contribute to the original upstream repository or to work independently on your own project. Any existing forks default to contributing changes to their upstream repositories. You can modify this choice at any time. For more information, see "Managing fork behavior".

You can also clone a repository directly from GitHub or GitHub Enterprise. For more information, see "Cloning a repository from GitHub to GitHub Desktop".

Cloning a repository

  1. In the File menu, click Clone Repository.

    Screenshot of the "GitHub Desktop" menu bar on Windows. The "File" dropdown menu is expanded, and the "Clone Repository" option is highlighted with an orange outline.

  2. Click the tab that corresponds to the location of the repository you want to clone. You can also click URL to manually enter the repository location.

    Screenshot of the "Clone a repository" window. At the top of the window, tabs labeled "GitHub.com", "GitHub Enterprise" and "URL" are highlighted with an orange outline.

  3. From the list of repositories, click the repository you want to clone.

    Screenshot of the "Clone a repository" window. The "github/docs" repository is highlighted with an orange outline.

  4. To select the local directory into which you want to clone the repository, next to the "Local Path" field, click Choose... and navigate to the directory.

    Screenshot of the "Clone a repository" window. A button, labeled "Choose", is highlighted with an orange outline.

  5. At the bottom of the "Clone a Repository" window, click Clone.

Forking a repository

You can fork a repository on GitHub.com or in GitHub Desktop. For information about forking on GitHub.com, see "Fork a repo."

In GitHub Desktop, if you attempt to clone a repository that you don't have write access to, a fork is automatically created for you.

  1. In the File menu, click Clone Repository.

    Screenshot of the "GitHub Desktop" menu bar on Windows. The "File" dropdown menu is expanded, and the "Clone Repository" option is highlighted with an orange outline.

  2. Click the tab that corresponds to the location of the repository you want to clone. You can also click URL to manually enter the repository location.

    Screenshot of the "Clone a repository" window. At the top of the window, tabs labeled "GitHub.com", "GitHub Enterprise" and "URL" are highlighted with an orange outline.

  3. From the list of repositories, click the repository you want to clone.

    Screenshot of the "Clone a repository" window. The "github/docs" repository is highlighted with an orange outline.

  4. To select the local directory into which you want to clone the repository, next to the "Local Path" field, click Choose... and navigate to the directory.

    Screenshot of the "Clone a repository" window. A button, labeled "Choose", is highlighted with an orange outline.

  5. At the bottom of the "Clone a Repository" window, click Clone.

  6. Read the information in the "How are you planning to use this fork?" window.

    • If you plan to use this fork for contributing to the original upstream repository, click To contribute to the parent project.
    • If you plan to use this fork for a project not connected to the upstream, click For my own purposes.
  7. Click Continue.

Managing fork behavior

You can change how a fork behaves with the upstream repository in GitHub Desktop.

  1. In the menu bar, select Repository, then click Repository settings....

    Screenshot of the "GitHub Desktop" menu bar on Windows. In the open "Repository" dropdown menu, an option labeled "Repository Settings" is outlined in orange.

  2. In the "Repository settings" window, in the left-hand sidebar, click Fork Behavior.

  3. Under "I'll be using this fork...", use the radio buttons to select how you want to use the fork.

    Screenshot of the "Fork Behavior" pane. Two radio buttons, labeled "To contribute to the parent repository" and "For my own purposes", are outlined in orange.

  4. Click Save.

Creating an alias for a local repository

You can create an alias for a local repository to help differentiate between repositories of the same name in GitHub Desktop. Creating an alias does not affect the repository's name on GitHub. In the repositories list, aliases appear in italics.

  1. In the upper-left corner of GitHub Desktop, to the right of the current repository name, click .
  2. Right-click the repository you want to create an alias for, then click Create Alias.
  3. Type an alias for the repository.
  4. Click Create Alias.

Further reading

Press alt+up to activate