[GitHub] 프라이빗 리포지토리 Clone하기

[GitHub] 프라이빗 리포지토리 Clone하기


GitHub
  • 깃헙의 프라이빗 저장소는 권한이 있는 사람만 접근할 수 있으므로 HTTP로 클론할 수 없습니다.

  • 클론하고 싶은 머신에서 SSH Key를 발급 받고, 깃헙에 Public Key를 등록하면 해당 머신에서는 정상적으로 클론이 가능합니다.

SSH Key 생성

> ssh-keygen
  • 예시
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/baeseungwon/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/baeseungwon/.ssh/id_rsa
Your public key has been saved in /Users/baeseungwon/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:LtHLkjkvWvQYRK+SgsVISX/By66csuFQgED0G+LQxU baeseungwon@Baeseungwon-MacBook-Pro.local
The key's randomart image is:
+---[RSA 3072]----+
|O.o E..          |
|.*.o.. . .       |
|+.=oo o +        |
|.+o+oo =         |
|.ooo..= S        |
|..o+.. X .       |
|+ o.. O =        |
|.+ o ..=         |
|  o .. ..        |
+----[SHA256]-----+
  • passphrase를 입력하면 위 경로에 프라이빗 키(id_rsa)와 퍼블릭 키(id_rsa.pub)가 생성됩니다.

SSH Key 복사

> cat ~/.ssh/id_rsa.pub
  • 예시

GitHub에 공개 키 등록

  • -> Setting

  • -> New SSH Key

  • -> Add SSH Key

프라이빗 저장소 SSH 주소 복사

프라이빗 저장소 클론

> git clone git@github.com:seungwonbased/astrofy.git
© 2024 Seungwon Bae 🇰🇷