Giit 명령 시작: Giit 맞춤형 기능(config, SSH keys) 제78회
이번에도 이 문서를 이어가겠습니다. 이번엔 GiitHub의 SSH Key 설정입니다. 더 돌아가겠습니다~!
7.4Git의 다양한 도구 - 서명 작업 내용
SSH를 사용하여 Git 본사에 연결된 문서
본 사이트의 문서 시작!
SSH 정보
SSH 프로토콜을 사용하는 경우 원격 서버와 서비스에 연결하여 인증을 받을 수 있습니다.SSH 키를 사용하면 사용자 이름과 개인 액세스 카드를 입력하지 않고 GiitHub에 연결할 수 있습니다.
저번 기사는 이쪽부터!
git 본가의 문서 메뉴 여기 있습니다!
GPG를 설정할 때 조금 신경 쓰여요!
처음엔 기릿본가 홈페이지 글도 인용했는데 자신의 공개 키가 SSH Key인데 기릿허브에 로그인하면 창고의push에 비밀번호를 입력하지 않고 올릴 수 있으니 이 초록색 버튼을 누르지 않으면 안 되지~ (^;)
본 사이트의 문서도 쉽게 이해할 수 있습니다!
내 환경에서 Linux를 선택하십시오!다른 Mac, Windows도 잘 준비하고 있습니다!
그렇다면~ 내 홈페이지 필요없냐!!!됐다!(폭소)
ls -al ~/.ssh에서 기존 SSH 키의 존재를 확인합니다!
$ ls -al ~/.ssh
合計 8
drwx------ 2 test test 28 1月 17 09:09 .
drwx------ 8 test test 4096 4月 8 10:30 ..
-rw------- 1 test test 408 1月 17 09:09 authorized_keys
그나저나 센트OS에 테스트 계정을 새로 만들었어요.따라서 SSH Key 파일이 없습니다.ssh-keygen -t ed25519 -C "[email protected]"
$ ssh-keygen -t ed25519 -C "[email protected]"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/test/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/test/.ssh/id_ed25519.
Your public key has been saved in /home/test/.ssh/id_ed25519.pub.
The key fingerprint is:
9c:ad:06:f8:cf:71:a6:08:f5:6c:3b:6a:3c:2d:f7:48 [email protected]
The key's randomart image is:
+--[ED25519 256--+
| |
| |
| |
| . . o |
| . o S . |
| o + . |
| ....E o |
| .=B+B |
| .o=*o. |
+-----------------+
$ ls -al ~/.ssh
合計 16
drwx------ 2 test test 66 4月 9 11:23 .
drwx------ 8 test test 4096 4月 8 10:30 ..
-rw------- 1 test test 408 1月 17 09:09 authorized_keys
-rw------- 1 test test 464 4月 9 11:23 id_ed25519
-rw-r--r-- 1 test test 104 4月 9 11:23 id_ed25519.pub
ssh-agent에 SSH 비밀 키 추가
이 암호문은 안전하게 저장할 수 있다.이렇게 되면 매번 암호문을 들을 수 없게 된다.이쪽도 당분간, 우선 GiitHub 사이트의 문서를 통째로 실행합니다!
$ eval `ssh-agent -s`
> Agent pid 59566
$ ssh-add ~/.ssh/id_ed25519
// ↑↑↑ 秘密鍵を追加!
GiitHub 계정에 SSH 공개 키를 추가합니다.
$ cat ~/.ssh/id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE ~省略~ [email protected]
공개 키를 출력하고 화면에서 GiitHub의 SSH Key에 로그온합니다.ssh-ed25519~생략[email protected]
제목은test, 임시 등록을 시도해 봤습니다!
연결 테스트 [email protected]
$ ssh -T [email protected]
The authenticity of host 'github.com (52.192.72.89)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,52.192.72.89' (RSA) to the list of known hosts.
Hi shiozumi-makoto! You've successfully authenticated, but GitHub does not provide shell access.
vi ~/.ssh/config 프로필 만들기
$ cat ~/.ssh/config
Host github github.com
HostName github.com
IdentityFile ~/.ssh/id_ed25519
User git
$ chmod 644 ~/.ssh/config
재접속 테스트 [email protected]
$ ssh -T [email protected]
Hi shiozumi-makoto! You've successfully authenticated, but GitHub does not provide shell access.
아마 Warning:Permanently는 이미 출력하지 않을 거예요.그럼 마지막으로 실제로 push를 해보세요!
다음은 새 창고를 만들 때 출력되는 일반적인 초기화 명령의 집합입니다.
echo "# 20210409" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:shiozumi-makoto/20210409.git
git push -u origin main
git remote add origin의 주소가 변경되었습니다!
SSH를 선택하십시오.SSH를 클릭하면 스크립트 명령의 내용이 완전히 바뀝니다.편하네.(⌒∇⌒)
총 git push ID와 비밀번호가 없어도 OK!
그럼 여러분도 무사히 SSH 연결을 통해 창고의push를 완성하셨나요?저도 모든 환경에서 시도해 본 적이 없어서 뭐라고 할 수는 없지만 SSH 연결을 통해 개발 효율을 높여야 합니다.이런 환경 설정, 또 매번 후회하는 글, 정말 죄송합니다, 처음 해야 할 일이네요~ (^;)
그럼, 이번엔 여기까지 수고하셨습니다!
Reference
이 문제에 관하여(Giit 명령 시작: Giit 맞춤형 기능(config, SSH keys) 제78회), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/shiozumi/articles/9c4a2a2108a8f3텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)