このバージョンの GitHub Enterprise はこの日付をもって終了となりました: 2021-09-23. 重大なセキュリティの問題に対してであっても、パッチリリースは作成されません。 パフォーマンスの向上、セキュリティの改善、新機能のためには、最新バージョンのGitHub Enterpriseにアップグレードしてください。 アップグレードに関する支援については、GitHub Enterprise supportに連絡してください。

Git に GitHub の認証情報をキャッシュする

If you're cloning GitHub Enterprise Server repositories using HTTPS, we recommend you use GitHub CLI or Git Credential Manager Core (GCM Core) to remember your credentials.

Tip: If you clone GitHub Enterprise Server repositories using SSH, then you can authenticate using an SSH key instead of using other credentials. SSH 接続のセットアップについては「SSH キーを生成する」を参照してください。

GitHub CLI

GitHub CLI will automatically store your Git credentials for you when you choose HTTPS as your preferred protocol for Git operations and answer "yes" to the prompt asking if you would like to authenticate to Git with your GitHub Enterprise Server credentials.

  1. Install GitHub CLI on macOS, Windows, or Linux.
  2. In the command line, enter gh auth login, then follow the prompts.
    • When prompted for your preferred protocol for Git operations, select HTTPS.
    • When asked if you would like to authenticate to Git with your GitHub Enterprise Server credentials, enter Y.

For more information about authenticating with GitHub CLI, see gh auth login.

Git Credential Manager Core

Git Credential Manager Core (GCM Core) is another way to store your credentials securely and connect to GitHub over HTTPS. With GCM Core, you don't have to manually create and store a PAT, as GCM Core manages authentication on your behalf, including 2FA (two-factor authentication).

  1. Install Git using Homebrew:

    $ brew install git
  2. Install GCM Core using Homebrew:

    $ brew tap microsoft/git
    $ brew install --cask git-credential-manager-core

    For MacOS, you don't need to run git config because GCM Core automatically configures Git for you.

The next time you clone an HTTPS URL that requires authentication, Git will prompt you to log in using a browser window. You may first be asked to authorize an OAuth app. If your account or organization requires two-factor auth, you'll also need to complete the 2FA challenge.

認証に成功すると、認証情報は macOS のキーチェーンに保存され、HTTPS URL をクローンするたびに使用されます。 Git will not require you to type your credentials in the command line again unless you change your credentials.

  1. Install Git for Windows, which includes GCM Core. For more information, see "Git for Windows releases" from its releases page.

We recommend always installing the latest version. At a minimum, install version 2.29 or higher, which is the first version offering OAuth support for GitHub.

The next time you clone an HTTPS URL that requires authentication, Git will prompt you to log in using a browser window. You may first be asked to authorize an OAuth app. If your account or organization requires two-factor auth, you'll also need to complete the 2FA challenge.

Once you've authenticated successfully, your credentials are stored in the Windows credential manager and will be used every time you clone an HTTPS URL. Git will not require you to type your credentials in the command line again unless you change your credentials.


Warning: Older versions of Git for Windows came with Git Credential Manager for Windows. This older product is no longer supported and cannot connect to GitHub via OAuth. We recommend you upgrade to the latest version of Git for Windows.

Warning: If you cached incorrect or outdated credentials in Credential Manager for Windows, Git will fail to access GitHub Enterprise Server. To reset your cached credentials so that Git prompts you to enter your credentials, access the Credential Manager in the Windows Control Panel under User Accounts > Credential Manager. Look for the GitHub Enterprise Server entry and delete it.

For Linux, install Git and GCM Core, then configure Git to use GCM Core.

  1. Install Git from your distro's packaging system. Instructions will vary depending on the flavor of Linux you run.

  2. Install GCM Core. See the instructions in the GCM Core repo, as they'll vary depending on the flavor of Linux you run.

  3. Configure Git to use GCM Core. There are several backing stores that you may choose from, so see the GCM Core docs to complete your setup. For more information, see "GCM Core Linux."

The next time you clone an HTTPS URL that requires authentication, Git will prompt you to log in using a browser window. You may first be asked to authorize an OAuth app. If your account or organization requires two-factor auth, you'll also need to complete the 2FA challenge.

Once you've authenticated successfully, your credentials are stored on your system and will be used every time you clone an HTTPS URL. Git will not require you to type your credentials in the command line again unless you change your credentials.

For more options for storing your credentials on Linux, see Credential Storage in Pro Git.


For more information or to report issues with GCM Core, see the official GCM Core docs at "Git Credential Manager Core."

問題がまだ解決していませんか?