오늘의 인기 글
최근 글
최근 댓글
Today
Total
05-09 00:00
관리 메뉴

우노

[GitHub] 토큰을 사용한 계정 등록 방법 본문

DevOps/GitHub

[GitHub] 토큰을 사용한 계정 등록 방법

운호(Noah) 2022. 4. 8. 14:32

비밀번호 인증을 통한 계정 등록 (현재는 중지된 방법)

  • 만약, GitHub 계정이 등록 되어있지 않은 상태에서 Commit 을 할 경우, 아래와 같은 오류가 발생하게 됩니다.

      *** Please tell me who you are.
    
      Run
    
        git config --global user.email "you@example.com"
        git config --global user.name "Your Name"
    
      to set your account's default identity.
      Omit --global to set the identity only in this repository.
    
      fatal: unable to auto-detect email address (got 'root@8f0316781f30.(none)')
  • 따라서, 기존에는 GitHub 계정을 등록하기 위해, 아래와 같이 비밀번호 인증을 진행했었습니다.

      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"
      git push origin main
    
      Username for 'https://github.com':
      Password for 'https://unhochoi@github.com': 
  • 하지만, 비밀번호 인증을 통한 계정 등록은 2021년 8월 13일에 제거되었기 때문에, 아래와 같은 오류가 발생하게 됩니다.

      remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
      remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
      fatal: Authentication failed for 'https://github.com/unhochoi/edge-inference.git/'
  • 따라서, 이젠 비밀번호 대신 개인 엑세스 토큰을 사용해 계정을 등록해야합니다.

개인 액세스 토큰을 사용한 계정 등록 방법

  • Github 로그인 후, 우측 상단 계정의 Settings 클릭합니다.

  • 좌측 맨 하단의 Developer settings 클릭합니다.

  • 좌측의 Personal access tokens 클릭합니다.

  • 우측 상단의 Generate new token 클릭합니다.

  • 토큰명, 토큰기한, 사용범위를 선택한 뒤, 하단의 Generate token 을 클릭합니다.

  • 생성된 토큰 값을 복사합니다.

  • git clone 또는 git push 명령 시, Password 로 발급 받은 토큰을 입력합니다.

      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"
      git push origin main
    
      Username for 'https://github.com':
      Password for 'https://unhochoi@github.com': '발급 받은 토큰'
Comments