bower install 에러
github code pull download error, git clone error, git 인증, github auth

//-------------------------------------
- 에러 메시지
 fatal: Could not read from remote repository. git@github.com: Permission denied (publickey).

- 해결 방법 : 인증 설정

 

//-----------------------------------------------------------------------------

- 인증 방법 1 : 토큰 인증 방식

 

* 인증 토큰 생성
https://github.com/settings/tokens
tokens (classic) -> Generate new token -> Generate new token (classic)
- 토큰 이름 작성
- Expiration : No expiration
- Select scopes : repo 체크
- 중요! 생성된 토큰 문자열을 다른 파일에 저장 


* 인증 방법 설정
git config --global credential.helper manager

* 인증 실행
     - github 연결 명령어
git clone https://github.com/저장소
git fetch 

- git-credential-manager.exe 가 실행됨
- Add a new account -> Token -> 이전에 생성된 토큰 붙여넣기

 

 

---------------------------------------

* 저장소 연결시 마다 인증창이 뜨는 경우 해결 방법
    - 원인 : 여러계정이 설정된 경우

 

    - 방법1 : 현재 저장소의 연결 계정 설정

git remote set-url origin https://아이디@github.com/저장소

 

 

     - 방법2 : 모든 계정 삭제

제어판 -> 자격 증명 관리자 -> Windows 자격 증명
          - github 관련 증명을 다 삭제

 

 

-------------------------------------------------------------------------------
- 인증 방법 2 : SSH 키 사용

    - 접속 테스트
ssh -vT git@github.com


    - SSH agent  시작
ssh-agent -s

    - 키 찾기
ssh-add -l -E sha256


    - 키 생성
ssh-keygen -t rsa -b 4096 -C "깃허브 계정 이메일"

    - 등록
ssh-add ~/.ssh/id_rsa

    - 확인
cat ~/.ssh/id_rsa.pub


    - github.com 설정 - 키 등록
- Settings -> Access : SSH and GPG keys -> New SSH key ->
C:\Users\userID\.ssh\id_rsa.pub 파일 내용 붙혀넣기

 

 

-------------------------------------------------------------------------------
// 참고
https://docs.github.com/en/authentication/troubleshooting-ssh/error-permission-denied-publickey

https://careerkarma.com/blog/git-permission-denied-publickey/


반응형
Posted by codens