본문 바로가기
Programming

Github CLI Install Ubuntu 22.04

by 개발자 염상진 2023. 2. 9.

 

1. 터미널 실행

아래 코드 입력. 터미널에 Github CLi install

type -p curl >/dev/null || sudo apt install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y

 

2. Github Login

터미널에 아래 명령어 입력

$ gh auth login

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

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


? Upload your SSH public key to your GitHub account?  [Use arrows to move, type to filter]
  /home/testuser/.ssh/id_rsa.pub
> /home/testuser/.ssh/id_rsa_about-tech.pub
  Skip

? Title for your SSH key: (GitHub CLI) SSH for AboutTech


> Login with a web browser
  Paste an authentication token
  
  
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: EB50-6A89
Press Enter to open github.com in your browser... 
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
Opening in existing browser session.

 

instruction 따라서 선택하고 엔터치면 브라우저에서 Github에 연결하는 Auth 화면이 출력됩니다. 여기서 터미널에 출력된 one-time code를 입력합니다. 

연결을 완료합니다. 

Github 암호를 입력하면 정상적으로 연결됩니다. 

 

연결이 정상적을 완료되면 터미널에서 완료 표시가 뜹니다.

✓ Authentication complete.
- gh config set -h github.com git_protocol ssh
✓ Configured git protocol
✓ Uploaded the SSH key to your GitHub account: /home/testuser/.ssh/id_rsa_about-tech.pub
✓ Logged in as About-Tech

 

등록이 완료 된 후 Settings > SSH and GPG keys 탭에 들어가면 방금 등록한 SSH 키가 정상적으로 등록되어 있습니다.

 

 

Reference

https://github.com/cli/cli/blob/trunk/docs/install_linux.md

 

 

🚀️ 도움이 되셨다면 구독좋아요 부탁드립니다 👍️

댓글