하모니카 묻고답하기

2020.09.22 10:18

Github CLI 사용법

조회 수 885 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

깃헙 사용을 터미널에서 쉽게 할 수 있도록 도와주는 도구 Github CLI 가 얼마전 출시되었습니다.

터미널에서 깃허브 저장소의 이슈 처리, PR 관리, 릴리즈 관리들의 유용한 기능을 제공합니다.

설치하기

 

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh
 

깃허브 로그인

 

먼저 자신의 깃허브 계정으로 로그인과정을 거쳐야 합니다.

$ gh auth login

어떤 방식으로 로그인할지 묻는 화면이 나오면 브라우저로 로그인을 선택하고 엔터를 치세요.

화면과 같이 일회용 디바이스 인증코드가 나오는데 이걸 복사합니다.

엔터를 치면 웹브라우저가 열리고 아래와 같은 화면이 나옵니다.

이전에 복사한 인증코드를 붙여넣기 하세요.

깃허브 계정으로 로그인 후 권한을 설정합니다.

마지막으로 어떤 프로토콜로 깃허브를 사용할지 http 또는 ssh 를 선택합니다.

정상적으로 로그인이 완료되면 다음과 같이 나타납니다.

 

Github CLI 기본 사용법

이슈 관리

다음과 같이 이슈를 확인하고 처리할 수 있습니다.

이슈 목록 확인

# Viewing a list of open issues
~/Projects/my-project$ gh issue list
 
Issues for owner/repo
 
#14  Update the remote url if it changed  (bug)
#14  PR commands on a detached head       (enhancement)
#13  Support for GitHub Enterprise        (wontfix)
#8   Add an easier upgrade command        (bug)
 
 
이슈를 터미널에서 대화형으로 생성
# Create an issue interactively
~/Projects/my-project$ gh issue create
Creating pull request for feature-branch into main in owner/repo
? Title My new issue
? Body [(e) to launch nano, enter to skip]
http://github.com/owner/repo/issues/1
 
이슈를 명령줄에서 한줄로 생성
# Create an issue using flags
~/Projects/my-project$ gh issue create --title "Issue title" --body "Issue body"
http://github.com/owner/repo/issues/1
 

이슈를 웹브라우저로 생성

// Quickly navigate to the issue creation page
~/Projects/my-project$ gh issue create --web
Opening https://github.com/owner/repo/issues/new in your browser.
 
이슈 닫기

gh issue close {<number> | <url>} [flags]

 

풀리퀘스트(PR) 관리

요청된 PR을 체크아웃

// Checking out a pull request locally
~/Projects/my-project$ gh pr checkout 12
remote: Enumerating objects: 66, done.
remote: Counting objects: 100% (66/66), done.
remote: Total 83 (delta 66), reused 66 (delta 66), pack-reused 17
Unpacking objects: 100% (83/83), done.
From https://github.com/owner/repo
 * [new ref]             refs/pull/8896/head -> patch-2
M       README.md
Switched to branch 'patch-2'
 
PR의 변경내용 확인
gh pr diff [<number> | <url> | <branch>] [flags]

 

PR 머지하기

기본값으로 PR을 머지한 후에는 원격 저장소와 로컬 저장소의 PR 브랜치를 삭제하게 되어있습니다. 유지하려면 ‘–delete-branch=false’ 을 사용하세요.

gh pr merge [<number> | <url> | <branch>] [flags]

 

PR Close

gh pr close {<number> | <url> | <branch>} [flags]

 

더 많은 기능에 대한 자세한 사용법은 여기를 참고하세요.


  1. 게시판에 질문하기 전 읽기 - 어떻게 질문을 하는 것이 좋을까?

    Date2019.11.18 ByKevin Views13014 Votes0
    read more
  2. Github CLI 사용법

    Date2020.09.22 ByKevin Views885 Votes0
    Read More
  3. gnome-shell에 대하여

    Date2023.12.24 ByKevin Views479 Votes0
    Read More
  4. Godot 게임엔진

    Date2017.04.28 By행복한펭귄 Views8048 Votes0
    Read More
  5. Google Chrome 설치 후 갑자기 화면이 깜빡 거리면서 먹통이 되었습니다.

    Date2021.04.25 Byyoungman Views2006 Votes0
    Read More
  6. Google Chrome 지원 종료(EOS) 알림

    Date2016.03.13 By통나무 Views6306 Votes0
    Read More
  7. Google Remote Desktop 을 사용하려는데 "컴퓨터의 원격 연결을 사용하도록 설정 중"에서 멈춰있습니다.

    Date2016.03.08 ByKayKim Views7726 Votes0
    Read More
  8. google-chrome 대체 브라우저 - chromium

    Date2016.03.31 Bylegoboss Views4453 Votes0
    Read More
  9. grub customizer 실행 오류

    Date2024.04.19 By탁구공 Views119 Votes0
    Read More
  10. grub 메뉴삭제 방법 문의합니다.

    Date2019.08.21 By신성 Views1193 Votes0
    Read More
  11. GRUB 복구할때 사용하는 라이브 usb 질문인데요..

    Date2022.09.15 By블랙커피 Views594 Votes0
    Read More
  12. g마켓 스마일페이 정말 좋네요...

    Date2014.12.12 Bygilgaruru Views10089 Votes0
    Read More
  13. hamonikr 3.0 에서 qcomicbook 에러 질문

    Date2019.12.28 By관우 Views1097 Votes0
    Read More
  14. HamoniKR 3.0 피드백 사항

    Date2019.11.20 By반시12 Views962 Votes0
    Read More
  15. HamoniKR 3.0과 HamoniKR-ME 1.4 차이점 궁금합니다.

    Date2019.11.21 Byiskra Views1142 Votes0
    Read More
  16. HamoniKR 3.0에서 4.0으로 업데이트 오류

    Date2021.03.14 ByShine Views1022 Votes0
    Read More
  17. hamonikr 3.0에서 리눅스 그림판 kolourpaint 에러 질문

    Date2019.12.28 By관우 Views3166 Votes0
    Read More
  18. HamoniKR 4.0 에서 기본 ntfs 마운트(자동)시 안드로이드 repo sync문제

    Date2021.01.27 By아르테 Views642 Votes0
    Read More
  19. HAMONIKR 7.0 설치 -> 소프트웨어 검색 -> 오타 수정 요청

    Date2024.01.09 Byyoungman Views425 Votes0
    Read More
  20. HamoniKR 7.0?

    Date2023.08.19 Bykillsystem10 Views710 Votes0
    Read More
  21. Hamonikr Me

    Date2021.04.04 ByYueunseon Views1291 Votes0
    Read More
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 ... 124 Next
/ 124
CLOSE