Giit 명령 시작: Giit 맞춤형 기능(config, SSH keys) 제78회

11598 단어 GitGitHubtech
안녕하세요!저번에 마지막이었어요.끝났어, 뭐라고 생각해?아니면 제목에 답이 적혀 있든가.맞다 맞다 겟허브는 HTTPS 이외에도 SSH에 연결할 수 있대~

이번에도 이 문서를 이어가겠습니다. 이번엔 GiitHub의 SSH Key 설정입니다. 더 돌아가겠습니다~!


https://git-scm.com/book/ja/v2/Git-다양한 도구 - 작업 컨텐츠 서명 #rsigning
7.4Git의 다양한 도구 - 서명 작업 내용

SSH를 사용하여 Git 본사에 연결된 문서


https://docs.github.com/ja/github/authenticating-to-github/connecting-to-github-with-ssh
본 사이트의 문서 시작!
SSH 정보
SSH 프로토콜을 사용하는 경우 원격 서버와 서비스에 연결하여 인증을 받을 수 있습니다.SSH 키를 사용하면 사용자 이름과 개인 액세스 카드를 입력하지 않고 GiitHub에 연결할 수 있습니다.

저번 기사는 이쪽부터!


https://zenn.dev/shiozumi/articles/08f1488240e350

git 본가의 문서 메뉴 여기 있습니다!


https://git-scm.com/book/ja/v2

GPG를 설정할 때 조금 신경 쓰여요!



처음엔 기릿본가 홈페이지 글도 인용했는데 자신의 공개 키가 SSH Key인데 기릿허브에 로그인하면 창고의push에 비밀번호를 입력하지 않고 올릴 수 있으니 이 초록색 버튼을 누르지 않으면 안 되지~ (^;)

본 사이트의 문서도 쉽게 이해할 수 있습니다!


https://docs.github.com/ja/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

내 환경에서 Linux를 선택하십시오!다른 Mac, Windows도 잘 준비하고 있습니다!



그렇다면~ 내 홈페이지 필요없냐!!!됐다!(폭소)

ls -al ~/.ssh에서 기존 SSH 키의 존재를 확인합니다!


$ ls -al ~/.ssh
合計 8
drwx------ 2 test test   28  117 09:09 .
drwx------ 8 test test 4096  48 10:30 ..
-rw------- 1 test test  408  117 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  49 11:23 .
drwx------ 8 test test 4096  48 10:30 ..
-rw------- 1 test test  408  117 09:09 authorized_keys
-rw------- 1 test test  464  49 11:23 id_ed25519
-rw-r--r-- 1 test test  104  49 11:23 id_ed25519.pub
  • 암호문은 GiitHub과 함께 사용됩니다!
  • id_비밀 키 생성
  • 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.
    
  • yes/no를 물었기 때문에 먼저 yes와 입력
  • Warning: Permanently added가 표시되며 다음 설정을 수행합니다.
  • vi ~/.ssh/config 프로필 만들기


    
    $ cat ~/.ssh/config
    
    Host github github.com
      HostName github.com
      IdentityFile ~/.ssh/id_ed25519
      User git
      
    $ chmod 644 ~/.ssh/config
    
  • IdentityFile 다음에 비밀 키의 파일 이름을 설정합니다.
  • 접근권도 644로 재설정!
  • 재접속 테스트 [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 연결을 통해 개발 효율을 높여야 합니다.이런 환경 설정, 또 매번 후회하는 글, 정말 죄송합니다, 처음 해야 할 일이네요~ (^;)

    그럼, 이번엔 여기까지 수고하셨습니다!


    https://zenn.dev/shiozumi/articles/07373f9bdfed84

    좋은 웹페이지 즐겨찾기