포스트

[GIT] SSH key 생성 및 등록, ssh-config 설정

Git 을 위한 SSH Key 생성방법과, ssh-config 사용방법


SSH Key 발급 받기

1
ssh-keygen

  • Default Key 는 id_rsa 가 발급된다.
    • -t 을 통해 rsa, ed25519 를 선택해도 된다.
    • 예) ssh-keygen -t ed25519
  • 그냥 Enter 를 입력하면 key 를 이용할 때마다 비밀번호를 입력하지 않는다.
  • ~/.ssh/id_rsa 의 Private key 와 ~/.ssh/id_rsa.pub 의 Public key 를 생성한다.

ssh config 등록하기

  • ~/.ssh/config 파일은 SSH 접속을 편리하게 관리하는 설정 파일이다.
  • 서버별 설정을 저장하고 짧은 명령어로 빠르게 접속할 수 있다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# ~/.ssh/config

Host test_alias
	HostName test_ip_address
	User test_user_name
	IdentityFile ~/.ssh/test_public_key_path
	Port test_port_number

## Github 접속
Host github.com
	HostName github.com
	User github_id
	IdentityFile ~/.ssh/id_rsa_github
	IdentitiesOnly true
	Preferredauthentications publickey
Google AdSense — Post Ad
이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.

Comments powered by Disqus.