Preloader image
DDD

자바

Github - gpg (GnuPG) key 생성 방법 및 연동

작성자 관리자 (admin)
조회수 1,443
입력일 2020-06-25 21:47:17

파일 다운로드 : Git Bash 실행 (응용프로그램)
수정 : 2022.07.14 ( Authorize Error ! ) 로그인 방식 변경. (하단의 빨간색으로 내용 정리)

STEP 1~3 명령어로 등록
Github 사이트로 이동 후 -> settings -> SSH and GPG keys -> New GPG Key -> 붙여넣기 (주황색 전체) -> Add GPG Key -> 비밀번호입력 -> 새로운 비밀번호 입력 -> 완료 -> 이클립스 Git commit 시 비밀번호 입력 -> 완료 -> 기존 방식으로 Git 진행

STEP 1)
$ gpg --full-generate-key

gpg (GnuPG) 2.2.11-unknown; Copyright (C) 2018 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: Your_Name
Email address: Your_Email@gmail.com
Comment:
You selected this USER-ID:
    "Your_Name <Your_Email@gmail.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 143DF6CE9D277C6D marked as ultimately trusted
gpg: directory '/c/Users/user/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/c/Users/user/.gnupg/openpgp-revocs.d/1C4EB86DE69BDF668F799058143DF6CE9D277C6D.rev'
public and secret key created and signed.

pub   rsa2048 2020-06-25 [SC]
      1C4EB86DE69BDF668F799058143DF6CE9D277C6D
uid                      Your_Name<Your_Email@gmail.com>
sub   rsa2048 2020-06-25 [E]


user@DESKTOP-Q34P93Q MINGW64 ~

STEP 2)
$ gpg --list-secret-keys --keyid-format LONG

gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
/c/Users/user/.gnupg/pubring.kbx
--------------------------------
sec   rsa2048/143DF6CE9D277C6D 2020-06-25 [SC]
      1C4EB86DE69BDF668F799058143DF6CE9D277C6D
uid                 [ultimate] Your_Name<Your_Email@gmail.com>
ssb   rsa2048/2C1D396B8CF66718 2020-06-25 [E]

user@DESKTOP-Q34P93Q MINGW64 ~

STEP 3)
$ gpg --armor --export
143DF6CE9D277C6D

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBF70ksoBCADDmBkjgyvq5454/NCIyA/EESSU6ypLKIJEk5Xxk9/JTPHBMUNx
KhhRCp4Qb84Gy/L6T0lyX3wJXXy5JFjEEL979x23DW2qE251ofnCwPlXAJgGeR0R
YeMWDEUWHktFg1qmF024/vpgkwHzjs+a1j9qAe9A46W2S3I6vBUxzWeZfue0ZWBW
....
.... (생략)
....
CPw4zhRht80j6KTd1oXqeaQXh1B4h0JzghGPws6WxOkU7+4iQfMEgrqgU5YMZBAV
NUASUHK4nWlbrypVxN7Z3mrNjbMthxQFxhT6Fb1XCtoLJSapa9KL9lKqsbzzFUL/
0K8W4IDZrcgJ9LcT1XGZc3kKTBPk
=93lf
-----END PGP PUBLIC KEY BLOCK-----

user@DESKTOP-Q34P93Q MINGW64 ~

Github 사이트로 이동 후 -> settings -> SSH and GPG keys -> New GPG Key -> 붙여넣기 (주황색 전체) -> Add GPG Key -> 비밀번호입력 -> 새로운 비밀번호 입력 -> 완료 -> 이클립스 Git commit 시 비밀번호 입력 -> 완료 -> 기존 방식으로 Git 진행

------------ 2022.07.14 ------------

이클립스 GitStaging 에서 서명 후 Commit 시 로그인 창이 뜨는데 이 아이디와 비밀번호는 계정의 비밀번호가 아니다.
아래의단계를 따라하면 된다.

SETP1) Github 계정 접속
Step2) 오른쪽 상단의 클릭 - settings 클릭
STEP3) 왼쪽 하단의 <> Developer Settings 클릭
STEP4) New Github App 클릭
STEP5) 왼쪽 메뉴의 Personal App Token 클릭
STEP6) 오른쪽 상단 Generate new token 클릭
STEP7) Note 이름 작성 = 로그인 시 ID 가 됨.
STEP8) Selectscope -> repo, admin.org, delete_repo 3개를 체크
STEP9) 하단의 Gernerate Token 클릭

완료된 상태로 Token 을 복사해 두어야 합니다. 다시 볼수 없습니다.
이 Token 이 "비밀번호"가 됩니다.

ID : Note
PW : Token

 

 

 

 

 

^