[git] push, pull 할때 username, password 묻는경우(2)(ssh로 연결)

여리·2023년 4월 13일
0

새로운 로컬 컴퓨터(아이맥)으로 작업을 하려고 git 작업을 진행하려는데 이런메시지가 있어서 기록을 남겨놓게 됐다.

git push origin test
Username for 'https://github.com': zeler1004
Password for 'https://zeler1004@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/hongyeollee/wecode-42th-danggen-project.git/'

이게 발생.

chatGPT에게 물어보니 이런 안내가 나왔다

이 메시지는 2021년 8월 13일부터 GitHub에서 비밀번호 인증 방식을 지원하지 않기 때문에 발생합니다. 이것은 GitHub의 보안 정책 변경으로 인한 것입니다. 따라서, 이제는 토큰이나 SSH 키를 사용하여 인증해야 합니다.

토큰은 GitHub 계정 설정에서 생성할 수 있습니다. 토큰 생성 후, 로컬에서 git push를 할 때 해당 토큰을 입력하면 됩니다. SSH 키를 사용하는 경우에는 SSH 연결을 설정해야 합니다.

자세한 내용은 GitHub 문서를 참조하시기 바랍니다. (https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls)

그럼 ssh 키로 설정을 변경해볼까...

http를 ssh키로 변경하기 위해서는 github의 ssh키를 복사한다.

그럼 ssh키도 확인했으니 변경해볼까.

git remote 재설정하기

$ git remote set-url origin git@github.com:username/repo.git
나는 내 레포를 따올꺼니까 이렇게..
$ git remote set-url origin git@github.com:hongyeollee/wecode-42th-danggen-project.git

CLI로 명령어를 입력하고

$git remote -v

로 확인하여 fetch와 push의 링크가 바뀐 것을 알 수 있다.

요렇게.

profile
beckend developer

0개의 댓글