터미널에서 깃허브 로그인 방식이
github 토큰 인증 로그인 방법으로 바뀌었다.
보안상의 이유로, 사이트에서 token을 발급받아
인증해야만 사용이 가능하게 변했다.
이 과정에서 git clone, commit은 되는데
push가 되지 않는 error들이 몇 개 발생했다.
(알고 보니, "로그인" 자체가 되지 않아서
Repository가 연결되지 않은 문제였다.)
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/sjkim-jinnyk/last_tangerine/'
에러메시지를 보면, 2021년 8월부터
password 인증 방식이 없어졌다고 한다.
깃허브에 로그인하고,
Settings → Developer settings → Personal access tokens
① 여기서 Generate new token으로,
새로운 토큰 생성
② custom: 1년 기한으로 계산해서 넣기
- repo, admin:repo_hook 체크
(다른 거 체크해도 상관은 없지만,
보통 이거 2개만 check한다고 멘토님이 알려주셨다.)
→ 보통 레포지토리 관리만 하기 때문.
③ token 생성 key
이 페이지 바로 전에,
token 번호가 나온다.
※ 복사해놓고, 이메일로 보내놓거나
메모장에 잘 저장해두기
(이 페이지는 1번만 보여주고, 다시 보여주지 않는다.)
→ 토큰 재생성은 가능하다.
④ window 기준
자격 증명 관리자 → 일반 자격 증명 편집
- git:https://github.com 을 찾아보기.
- 사용자 이름 (github username)
- 암호 (아까 발급받은 token key 입력)
⑤ 위에 방법으로 token 등록이 안 될때!
vscode 터미널 내에서,
push를 하게 되면 "로그인 팝업 창"이 뜬다.
여기에 token 탭에서, 아까 발급받은 걸 입력하면 됨.
PS C:\Users\Administrator\last_tangerine> git push origin sun
remote: Repository not found.
fatal: repository 'https://github.com/github-seonyoungahn/githubPractice.git/' not found
원격의 레포지토리가 연결되지 않음.
이 문제는 협업하고 있는 팀원 분께,
invite mail을 받고 인증해야 한다.
git clone해서, 같이 협업하는 프로젝트일 때
repo 만든 팀원에게 꼭
invite 메일을 보내달라고 하자!
github ID mail주소로,
이런 메일이 와야 한다.
위에 조그만 파란색 글씨
"accept of decline" 글씨를 눌러서 승인받을 것!
PS C:\Users\Administrator\last_tangerine> git push origin sun
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/github-seonyoungahn/githubPractice.git/'
문제점: 최상위인 C드라이브에 git init 선언을 했던 것.
Adminstator에 "git init" 선언을 했었는데 이게 문제였다.
애초에 git은
개별 폴더마다 버전관리를 해주는 개념이다.
그런데 최상위에 해버리니, 하위폴더들에 버전관리가 되지 않았던 것이다.
※ push나 token error가 아니라,
상위 폴더가 꼬여서 로그인이 안 되는 문제였다.
(git init은 C드라이브 말고,
하위의 프로젝트 폴더에만 해주어야 한다.)
*adminstrator는 폴더 개념이 아니라,
"이 사용자로 로그인을 하겠다"는 개념.
애초에 C 드라이브나, 여기에 git init을 선언하면 안 된다.
해결방법: git 폴더를 삭제
git init은 project 최상위 폴더가 아닌 곳에만 선언하자..!
(한 번 선언해놓으면, 다른 곳에서도 쓸 수 있음)
→ 지금 내 컴퓨터는 git init을 여기저기 명령해놔서
git 폴더가 중복되어 있는 상태다.
꿀팁:
- cd last_ 까지만 누르고 tab 치면!!
경로가 자동완성!!
- 화살표(↑) 누르면, 전에 쳤던 명령어가 나온다.
[과정]
git status
git add .
git commit -m 'Update: test'
git push origin main
git log
위의 이것들을 입력하고 github repository를 확인해봤다.
*
github 토큰 인증 로그인 문제를 해결했다.
Repository not found는 결국 로그인이 안되서였다.
push error도 아니었고,
token에 문제가 있던 것도 아니었다.
PS C:\COOL_LION> git clone https://github.com/sjkim-jinnyk/last_tangerine
//Cloning into 'last_tangerine'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (6/6), done.//
PS C:\COOL_LION> cd .\last_tangerine\
PS C:\COOL_LION\last_tangerine> git status
// On branch main
//Untracked files:
(use "git add <file>..." to include in what will be committed)
test.html
nothing added to commit but untracked files present (use "git add" to track)
PS C:\COOL_LION\last_tangerine> git add .
PS C:\COOL_LION\last_tangerine> git commit -m 'Update: test'
//[main 1b78932] Update: test
create mode 100644 test.html
PS C:\COOL_LION\last_tangerine> git push origin main
//Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 482 bytes | 80.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/sjkim-jinnyk/last_tangerine
b7b58f6..1b78932 main -> main
PS C:\COOL_LION\last_tangerine> git log
//Author: seonyoungahn <내 메일@naver.com>
Date: Tue Dec 28 15:30:11 2021 +0900
Update: test
commit b7b58f65426772a9d15c0862df1f510d0b89bdd5
Author: 팀원 <팀원 메일@gmail.com>
Date: Tue Dec 21 23:56:43 2021 +0900
init : 초기 환경 세팅 //
원격 저장소 연결 후 작업순서 (pull,add,commit,push) (0) | 2022.01.07 |
---|---|
github 협업 메뉴얼: git-clone부터 Pull request까지 (0) | 2022.01.06 |
! [rejected] main -> main (fetch first) GIT PUSH 에러 해결법 (0) | 2021.12.24 |
댓글 영역