💡Aha!

github cli를 credential helper로 설정하기 (github cli로 git 로그인)

서론

GitHub CLI
Take GitHub to the command line
GitHub CLI
https://cli.github.com/
GitHub CLI

GitHub CLI는 GitHub에서 공식적으로 만든 CLI 도구로 커맨드 라인 환경에서 GitHub의 여러 이슈, 피알, 릴리즈 등을 관리할 수 있도록 만들어진 클라이언트다.

하지만 난 릴리즈 만들 때 빼곤 거의 쓰지 않는다. GUI 놔두고 CLI 보는건 귀찮거든.

GitHub 로그인

1gh auth login

다음 명령어를 입력 (GitHub CLI 로그인)

1? What account do you want to log into? [Use arrows to move, type to filter]
2> GitHub.com
3 GitHub Enterprise Server

1. GitHub.com 선택. (혹시라도 Enterprise가 아니라면)

1? What is your preferred protocol for Git operations? [Use arrows to move, type to filter]
2> HTTPS
3 SSH

2. 평소에 Git 사용 시에 자주 사용하던 프로토콜 선택. (나는 HTTPS를 선호한다)

1? How would you like to authenticate GitHub CLI? [Use arrows to move, type to filter]
2> Login with a web browser
3 Paste an authentication token

3. 나는 Login with a web browser 선택함.

1! First copy your one-time code: 27AC-C3F4
2Press Enter to open github.com in your browser...

4. 선택한 인증 방식에 맞춰 알아서 인증 One-time 코드 다음 단계에서 안보여주니까 미리 복사해놓기

글 작성자가 업로드 한 이미지
1✓ Authentication complete.
2- gh config set -h github.com git_protocol https
3✓ Configured git protocol
4✓ Logged in as ddarkr

5. 로그인 완료

Credential Helper로 사용하기

1gh auth setup-git

아무런 반응도 없으면 정상인듯.

마치며

축하한다. 이제 Git 사용할 때마다 귀찮게 로그인하지 않아도 된다.

2024 Dohyun Jung.
Made with ☕️.