프론트엔드 첫걸음

GitHub 계정에 새 SSH키 추가 본문

개발 공부/Git

GitHub 계정에 새 SSH키 추가

차정 2022. 7. 9. 22:43

https://docs.github.com/en/authentication/connecting-to-github-with-ssh

 

Connecting to GitHub with SSH - GitHub Docs

Secure your account with 2FA

docs.github.com

여기 나온 순서대로 하면 되는 생각보다 쉬운과정인데...

에러가 안난게 이상해서 성공한게 기뻐서 기록하는것..

 

 

1. SSH 정보란?

SSH 키를 사용하면 방문할 때마다 사용자 이름과 개인 액세스 토큰을 제공하지 않고도 GitHub에 연결할 수 있다.

 

2. 기존 키 확인

터미널에 아래 명령어 입력 

ls -al ~/.ssh
  • id_rsa.pub
  • id_ecdsa.pub
  • id_ed25519.pub

셋 중 하나가 없으면 새 SSH키 만들기

 

3. 새 SSH 키 생성 및 ssh-agent에 추가

- 새 SSH 키 생성 

$ ssh-keygen -t ed25519 -C "your_email@example.com"

키를 저장할 파일 입력하라고 하면 그냥 엔터키 누르고(엔터 대신 따로 저장위치 설정가능),

보안암호 입력 2번하면 아래와 같은 이미지 보여지면서 ssh키 생성됐다고 함

모야 왜 귀여운데

- ssh-agent에 추가

ssh-agent 실행

eval "$(ssh-agent -s)"

키 확인 

open ~/.ssh/config

 

파일 수정

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

 

 

4. 깃허브 계정에 새 SSH 키 추가

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

 

 

Adding a new SSH key to your GitHub account - GitHub Docs

Before adding a new SSH key to your account on GitHub.com, you should have: After adding a new SSH key to your account on GitHub.com, you can reconfigure any local repositories to use SSH. For more information, see "Switching remote URLs from HTTPS to SSH.

docs.github.com

 

 

5. SSH 연결 테스트 

터미널에 입력

ssh -T git@github.com

Hi [사용자명]!! You've successfully authenticated, but GitHub does not provide shell access.

 

라는 출력이 나오면 github에 ssh키로 연결 되는것이다.

'개발 공부 > Git' 카테고리의 다른 글

Git Push  (0) 2022.07.09
git remote add [원격이름] [원격저장소ur]  (0) 2022.07.09
git clone  (0) 2022.07.09
git reset  (0) 2022.07.08
git revert 로 커밋 원래대로 복구하기  (0) 2022.07.08