← 전체로 돌아가기
스킬 linux

GitHub Linux 인증 설정

Linux에서 GitHub CLI 및 Git 인증 설정 방법

githublinuxgitcliauthenticationpat

리눅스에서 GitHub 인증 설정하는 법이야.

  • gh cli 설치 및 인증:

    • sudo apt install gh
    • GitHub Developer Settings에서 PAT(Personal Access Token) 생성.
    • gh auth login 실행 후 PAT 붙여넣어 인증.
    • gh repo clone <owner>/<repo> 사용 또는 gh auth setup-git으로 Git 인증 설정.
  • Git 자격 증명 저장:

    • git config --global user.name "이름"user.email 이메일 설정.
    • 매번 로그인 방지: bash git config credential.helper store
    • git pull/push 시 로그인하면 다음부터 자동.

여기서 배울 것

  1. `gh cli` 설치 및 PAT(Personal Access Token) 사용법
  2. GitHub PAT 생성 시 `repo`, `read:org` 스코프 필요
  3. `git config credential.helper store`로 Git 자격 증명 자동 저장
  4. `gh repo clone`으로 편리하게 리포지토리 클론
원본 파일 보기 (.claude/skills/tn-github-linux-authentication/SKILL.md)
---
name: GitHub Linux 인증 설정
description: Use when the user needs to set up GitHub authentication on a Linux machine, configure `gh cli`, or set up Git to remember credentials for `git pull` or `git push`.
version: 1.0.0
source: /home/son/prj/resume/backup_notes_260317/notion/Tech Note/Github linux에서 로그인하는 법 2dcd7efd824b8078b8acfd0d09cc0a0b.md
---

# Github linux에서 로그인하는 법

gh cli 설치

```bash
sudo apt install gh
```

세팅 - 좌하단 developer setting 에 토큰 생성 있음

[https://velog.io/@tedxpem/Github-Personal-access-token-생성-방법](https://velog.io/@tedxpem/Github-Personal-access-token-%EC%83%9D%EC%84%B1-%EB%B0%A9%EB%B2%95)

token(classic)으로 생성

권한에 

The minimum required scopes are 'repo', 'read:org'.

필요

```bash
gh auth login
들어가서

? What account do you want to log into? **GitHub.com**
? What is your preferred protocol for Git operations? **HTTPS**
? Authenticate Git with your GitHub credentials? **No**
? How would you like to authenticate GitHub CLI? **Paste an authentication token**
```

근데 여전히 안됨

```jsx
son@son-wtr:~/prj$ git clone https://github.com/urustin/horangGotgam_server.git
Cloning into 'horangGotgam_server'...
Username for 'https://github.com': ^C
```

gh auth를 등록하거나

```bash
gh auth setup-git
```

clone 자체를

```bash
gh repo clone urustin/my-private-repo
```

git clone 대신 gh repo 이렇게 하거나.

---

git에서도 할것

글로벌 로그인이 필요함

안그러면 백날천날 맨날맨날 로그인 정보 물어봄

git pull, push할 때 다 물어봄

```bash
git config --global user.name "이름"
git config --global user.email 이메일
git config credential.helper store
```

이렇게 하면 pull이나 push할 때 로그인 정보 한번 더 물어봄

그때 로그인 마지막으로 해주면 그 다음부터 안물어봄