SSH로 github 연결~push까지

oching·2025년 8월 29일

Git

목록 보기
5/5

1️⃣ SSH 키 생성 (한 번만)

# SSH 키 생성
ssh-keygen -t ed25519 -C "your_email@example.com"

# 프롬프트:
# Enter → 기본 위치 (~/.ssh/id_ed25519)
# passphrase 원하면 입력, 없으면 Enter

2️⃣ SSH 에이전트 실행 & 키 등록

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

3️⃣ 공개키 확인 후 GitHub 등록

cat ~/.ssh/id_ed25519.pub
  1. 출력된 문자열 복사
  2. GitHub → Settings → SSH and GPG keys → New SSH key → 붙여넣기 → Add SSH key

4️⃣ 원격 레포지토리 SSH URL로 설정

git remote set-url origin git@github.com:oching-choi/plothly-dash.git

5️⃣ SSH 연결 테스트 (권장)

ssh -T git@github.com

#성공 메시지 예시:
#Hi oching-choi! You've successfully authenticated, but GitHub does not provide shell access.

6️⃣ 변경 사항 커밋 & Push

git add .
git commit -m "커밋 메시지 작성"
git push -u origin main

💡 팁

  • SSH 키는 한 번 등록하면 계속 사용 가능
  • ssh-add ~/.ssh/id_ed25519로 에이전트에 등록하면 passphrase 입력 생략 가능
profile
FE Studying

0개의 댓글