Github Linux 인증
gh cli 설치 및 git credential 기억 설정
Github linux에서 로그인하는 법
gh cli 설치
sudo apt install gh
세팅 - developer setting에 토큰 생성 있음. https://velog.io/@tedxpem/Github-Personal-access-token-%EC%83%9D%EC%84%B1-%EB%B0%A9%EB%B2%95
token (classic) 생성. 권한은 'repo', 'read:org' 필요.
gh auth login
프롬프트 따라가기: - GitHub.com - HTTPS - Authenticate Git with your GitHub credentials? No - How would you like to authenticate GitHub CLI? Paste an authentication token
근데 git clone 여전히 물어봄. wtf.
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 setup-git 하거나
gh auth setup-git
아니면 git clone 대신 gh repo clone 사용.
gh repo clone [user]/[repo-name]
git에서도 로그인 정보 기억시키기
안하면 pull, push할 때마다 로그인 정보 물어봄. 지저분함.
git config --global user.name "이름"
git config --global user.email 이메일
git config credential.helper store
이렇게 하면 pull/push 시 로그인 정보 한번 물어봄. 그때 로그인하면 다음부터 안 물어봄. 끝.
여기서 배울 것
- gh cli로 Github 인증하는 법
- PAT 생성 시 'repo', 'read:org' 권한 필요함
- git credential.helper store로 로그인 정보 기억시킴
- gh repo clone으로 private repo 쉽게 클론 가능
원본 파일 보기 (.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할 때 로그인 정보 한번 더 물어봄
그때 로그인 마지막으로 해주면 그 다음부터 안물어봄