본문 바로가기
LEARN/ERROR

[GIT] remote: Invalid username or password

by 아이엠제니 2023. 9. 6.

 

 


 

지역 저장소

> git init
> git config user.name "깃허브 아이디"
> git config user.email "깃허브 등록 이메일"
> git add README.md
> git commit -m "저장소 설명 추가"
> git branch -M main

> git log # 확인 가능

 

원격 저장소

> git remote add origin 경로
> git push origin main

이런 식으로 하면 원격저장소가 등록되어야 하지만?

에러가 났다.

토큰은 깃허브에서 발급받은 상태!

https://velog.io/@miyoni/remote-Invalid

해당 벨로그 참고해서 해결했다.

 

origin을 제거한 후, 다시 추가하면 된다고 한다.

> git remote remove origin

그러고 나서 다시 등록을 하는데!

이번에는 토큰값도 같이 넣어서 입력을 한다.

> git remote add origin https://닉네임:토큰@github.com/repository 경로

# 예

> git remote add origin https://gildong:tokenpassword@github.com/gildong/index.git

 

이런 식으로 입력한 후 다시 푸시를 하면 정상적으로 원격 저장소에 등록된 걸 알 수 있다.

@ 골뱅이 뒤에는 https://를 제외한 github 경로를 위 경로 그대로 입력하면 됨.

300x250