티스토리 뷰

Git

[Git] remote: Invalid username or password.

김콩콩쥐 2024. 2. 29. 11:43

오류 발생

git clone을 받으려고 하는데 아래와 같이 오류가 발생한다.

remote: Invalid username or password.

 

원인

git 설정이 풀린 문제로 토큰과 연결하면 된다.

해결방법

github 에서 토큰을 발급 받아야한다.
이미 존재한다면 2번부터 실행하면 된다.

1. github -> Settings -> Developer settings -> Personal access tokens 메뉴에서 토큰 발급 받기

 

2. 초기화

yungyeong@yungyeongui-MacBookAir glasstint % git init
힌트: Using 'master' as the name for the initial branch. This default branch name
힌트: is subject to change. To configure the initial branch name to use in all
힌트: of your new repositories, which will suppress this warning, call:
힌트: 
힌트:     git config --global init.defaultBranch <name>
힌트: 
힌트: Names commonly chosen instead of 'master' are 'main', 'trunk' and
힌트: 'development'. The just-created branch can be renamed via this command:
힌트: 
힌트:     git branch -m <name>
/Users/yungyeong/Project/glasstint/.git/ 안의 빈 깃 저장소를 다시 초기화했습니다

 

3. git 정보 등록

git remote add origin [git 주소]

 

4. 레파지토리 복제

git clone [new project url]
Username for 'https://github.com': [이름 입력]
Password for 'https://rachel@github.com': [1번의 토큰 입력]

 

새로운 회사를 다닐 때, 아니면 노트북을 포맷하거나 아이디를 회사계정, 개인계정을 여러개 쓸 때 자주 나올 수 있는 오류라고 생각한다.