Skip to main content

This version of GitHub Enterprise Server was discontinued on 2024-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.

Configuring Git for GitHub Desktop

You can manage Git configuration settings for your local repositories with GitHub Desktop.

Platform navigation

About Git configuration for GitHub Desktop

GitHub Desktop uses your local Git configuration settings and provides the option to configure some of these settings, such as the global author information and the default branch that is used when creating a new repository.

GitHub Desktop allows you to set the name and email address you would like associated with the commits you make in your repositories. If your name and email address have already been set in the global Git configuration for your computer, GitHub Desktop will detect and use those values. GitHub Desktop also allows you to set a different name and email address for an individual repository. This is useful when you need to use a separate work email address for a specific repository.

If the email address that has been set in your Git configuration does not match an email address associated with the GitHub Enterprise Server account you are currently logged in to, GitHub Desktop will show a warning prior to committing.

GitHub Desktop also allows you to change the default branch name that you would like to use when creating new repositories. By default, GitHub Desktop uses main as the default branch name in any new repositories you create.

Tip

Anyone will be able to see the email address in your Git configuration if you make public commits. For more information, see "Setting your commit email address."

Configuring your global author information

Configuring your global author information in GitHub Desktop will update the name and email address in your global Git configuration. This will be the default name and email address for all new local repositories you create in GitHub Desktop.

  1. In the menu bar, select GitHub Desktop, then click Settings.

    Screenshot of the menu bar on a Mac. Under the open "GitHub Desktop" dropdown menu, the cursor hovers over "Settings", which is highlighted in blue.

  2. In the "Settings" window, click Git.

    Screenshot of the "Git" pane in the "Preferences" window. In the left sidebar, an option labelled "Git" is highlighted in blue and outlined in orange.

  3. In the "Name" field, type the name you'd like to use for your Git configuration.

  4. In the "Email" dropdown menu, select the email address you would like to use for your commits. You can select an email address associated with your GitHub account, or select "Other" and enter another email address.

  5. Click Save.

  1. Use the File menu, then click Options.

    Screenshot of the "GitHub Desktop" menu bar on Windows. In the expanded "File" dropdown menu, the "Options" item is highlighted with an orange outline.

  2. In the "Options" window, click Git.

    Screenshot of the "Git" pane in the "Options" window. In the left sidebar, an option labeled "Git" is highlighted in blue and outlined in orange.

  3. In the "Name" field, type the name you'd like to use for your Git configuration.

  4. In the "Email" dropdown menu, select the email address you would like to use for your commits. You can select an email address associated with your GitHub account, or select "Other" and enter another email address.

  5. Click Save.

Configuring different author information for an individual repository

You can change the name and email address used to author commits in a specific repository. This local Git configuration will override your global Git configuration settings for this one repository only.

  1. To switch to the repository for which you want to set specific configuration, use the "Current Repository" dropdown menu.

    Screenshot of the repository bar in GitHub Desktop. Next to "Current Repository", a dropdown icon is highlighted with an orange outline.

  2. In the "GitHub Desktop" menu bar, select Repository and click Repository Settings....

    Screenshot of the menu bar on a Mac. In the open "Repository" dropdown menu, a cursor hovers over "Repository Settings", highlighted in blue.

  3. In the "Repository Settings" window, in the left sidebar, click Git Config.

  4. Under "For this repository I wish to", select Use a local Git config.

    Screenshot of the "Git Config" pane in the "Repository Settings" window. A selected radio button, labeled "Use a local Git config", is outlined in orange.

  5. In the "Name" field, type the name you'd like to use for your local Git configuration.

  6. In the "Email" dropdown menu, select the email address you would like to use for your commits. You can select an email address associated with your GitHub account, or select "Other" and enter another email address.

  7. Click Save.

  1. In the Repository menu, 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 sidebar, click Git Config.

  3. Under "For this repository I wish to", select Use a local Git config.

    Screenshot of the "Git Config" pane in the "Repository Settings" window. A selected radio button, labeled "Use a local Git config", is outlined in orange.

  4. In the "Name" field, type the name you'd like to use for your local Git configuration.

  5. In the "Email" dropdown menu, select the email address you would like to use for your commits. You can select an email address associated with your GitHub account, or select "Other" and enter another email address.

  6. Click Save.

Configuring your default branch for new repositories

You can configure the default branch that will be used when you create a new repository in GitHub Desktop. For more information about the default branch, see "About branches."

  1. In the menu bar, select GitHub Desktop, then click Settings.

    Screenshot of the menu bar on a Mac. Under the open "GitHub Desktop" dropdown menu, the cursor hovers over "Settings", which is highlighted in blue.

  2. In the "Settings" window, click Git.

    Screenshot of the "Git" pane in the "Preferences" window. In the left sidebar, an option labelled "Git" is highlighted in blue and outlined in orange.

  3. Optional, under "Default branch name for new repositories" edit the name of the default branch as needed.

  4. Click Save.

  1. Use the File menu, then click Options.

    Screenshot of the "GitHub Desktop" menu bar on Windows. In the expanded "File" dropdown menu, the "Options" item is highlighted with an orange outline.

  2. In the Options window, click Git.

    Screenshot of the "Git" pane in the "Options" window. In the left sidebar, an option labeled "Git" is highlighted in blue and outlined in orange.

  3. Under "Default branch name for new repositories", select the default branch name you would like to use, or, to enter a custom name, select "Other...".

  4. Click Save.

Further reading