Tip
If you clone GitHub repositories using SSH, then you can authenticate using an SSH key instead of using other credentials. For information about setting up an SSH connection, see SSH를 통한 GitHub 연결.
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 credentials.
- Install GitHub CLI on macOS, Windows, or Linux.
- 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 credentials, enter
Y
.
- When prompted for your preferred protocol for Git operations, select
For more information about authenticating with GitHub CLI, see gh auth login
.
Git Credential Manager
Git Credential Manager (GCM) is another way to store your credentials securely and connect to GitHub over HTTPS. With GCM, you don't have to manually create and store a personal access token, as GCM manages authentication on your behalf, including 2FA (two-factor authentication).
-
Install Git using Homebrew:
brew install git
-
Install GCM using Homebrew:
brew install --cask git-credential-manager
For macOS, you don't need to run git config
because GCM automatically configures Git for you.
다음에 인증이 필요한 HTTPS URL을 복제할 때 Git에서 브라우저 창을 사용하여 로그인하라는 메시지를 표시합니다. 먼저 OAuth app에 권한을 부여하라는 메시지가 표시될 수 있습니다. 계정 또는 조직에 2단계 인증이 필요한 경우 2FA 과제도 완료해야 합니다.
Once you've authenticated successfully, your credentials are stored in the macOS keychain 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 information or to report issues with GCM, see the official GCM docs at Git Credential Manager.