Programming/R

[Github] Rstudio와 Github연결시 GPG ERROR

김해김씨99대손 2024. 7. 1. 19:37

 

기존 조건

1. Git-hub가입

2. Git 설치

3. Rstudio와 R 설치 

 

새로운 R project를 만들면서 동시에 연동하는 방법

- 출처) https://www.youtube.com/watch?v=KdpNijR0RPk

- 참고) https://happygitwithr.com/

 

 

1. Git hub에서도 "Myproject" 이름으로 생성

2. [New project] -[Version Control] -"Myproject"라는 이름에 Gut저장소의 SSH 주소 붙여 넣기

=> 연동되었다면 Git tab생성됨

3. Git에서 생성자 등록 # 여러 사람이 사용 시 사용자 표시가 필요함으로 등록 ㅇㅇ 

- Git열기 

- 아래 스크립트 입력

$ git config --global user.name "So-Yeon Kim"
$ git config --global user.email "kim.soyeon.bio@gmail.com"
$ git config --list # 확인

 

 

 

기존 Project를 Commit 하기 

- 조건: R와 Git이 연동되어있어야 함(왼쪽 위에 Git tab 존재 여부로 확인

1. [tools]-[Version Control]-[Project Setup]-"Version control system"을 "Git"으로 설정

2. Commit 이후 Github에서 생성된 R 문서 확인하기 

 

 

Commit 및 Push 하기 

1. 수정된 R 문서 저장 

2. Git tab에서 commit  

- Commit 문구 저장-[Commit]-[Push]

 

🚨 Error 메시지 🚨

gpg: skipped "ABCDMYKEY12345": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object

 

- 해결법

1) https://stackoverflow.com/questions/72575423/gpg-skipped-key-no-secret-key-error-message-when-trying-to-sign-a-git-commit-on

참고) https://docs.github.com/ko/authentication/managing-commit-signature-verification/generating-a-new-gpg-key

 

Git에 접속 한 다음 아래 단계를 수행해 줍니다. 

# Git내부의 gpg 위치 등록 
git config --global gpg.program "C:/Program Files/Git/usr/bin/gpg.exe"

# 새로운 키 만들기 
gpg --full-generate-key
	# 키 name을 얻을 수 있다. 이를 복사하자

# Git에 새로 등록된 코드를 입력해 준다. 
git config --global user.signingkey 8DCAD9B************

# 에러 확인 
GIT_TRACE=1 git commit --allow-empty -m "signing"
	# 잘 등록 되었다면 오케이!

 

또한 생성된 GPG 코드를 Git에 등록하는 방법 

- https://docs.github.com/ko/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account

# 생성된 키 확인
gpg --list-secret-keys --keyid-format=long
	# 키 이름을 복사
    # 저는 39E7C36******* 키 이름을 가졌습니다. 


# 키 블록 확인 
gpg --armor --export 39E7C36******* 
	# -----BEGIN PGP PUBLIC KEY BLOCK-----로 시작하고 -----END PGP PUBLIC KEY BLOCK-----로 끝나는 GPG 키를 모두 복사

그다음 단계는 아래와 같이 수행

  1. [Setting]-[Acsess]의 [SSH and GPG keys]
  2. [GPG keys] 옆에  헤더 옆에 [New GPG keys]를 클릭합니다.
  3. "Title" 필드에 GPG 키의 이름을 입력합니다.
  4. “Key” 필드에 GPG 키를 생성할 때 복사한 GPG 키를 붙여 넣습니다.
  5. [Add GPG key] 클릭

 

반응형