git 인증을 위해 ssh key 등록하기

cozzin·2024년 5월 18일
0
(base) seongho@seonghos-MacBook-Air ~ % ls -al ~/.ssh
total 8
drwx------@  3 seongho  staff    96  3  1 21:32 .
drwxr-x---+ 43 seongho  staff  1376  5 18 09:40 ..
-rw-r--r--@  1 seongho  staff    92  3  1 21:32 known_hosts

새로 세팅한 맥북이라 ssh key가 없다.
참고하기 => https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

$ ssh-keygen -t ed25519 -C "hsh3592@gmail.com"

어느 위치에 ssh key 생성할 것 인지 알려준다.
생성한 ssh key의 위치를 config 파일로 터미널에 알려준다.

touch ~/.ssh/config

~/.ssh/config file에 들어갈 내용

Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519
$ pbcopy < ~/.ssh/id_ed25519.pub
# Copies the contents of the id_ed25519.pub file to your clipboard

클립보드에 복붙된 것을 github settings > Add new SSH key에 넣어주기

profile
Software Engineer

0개의 댓글