GitHub-API -CLI
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
gh commands
https://cli.github.com/manual/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
How to Use GitHub CLI : https://www.youtube.com/watch?v=BRAG1Kj4-Ss
Authenticate with GitHub
[root@cmptest01-cc github-cli]# gh auth login
? What account do you want to log into? GitHub.com
? You're already logged into github.com. Do you want to re-authenticate? Yes
? What is your preferred protocol for Git operations? HTTPS
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: 7E8D-5D9A
Press Enter to open github.com in your browser...
! Failed opening a web browser at https://github.com/login/device
exec: "xdg-open,x-www-browser,www-browser,wslview": executable file not found in $PATH
Please try entering the URL in your browser manually
✓ Authentication complete.
- gh config set -h github.com git_protocol https
✓ Configured git protocol
✓ Logged in as sbalakrishn
Set your default Text Editor
$ gh config set editor "code --wait" //When you are making commits you do not want VSCODE to exit the CLI. because it can break your commit messages
--wait VSCode waits for you to close all the file instance.
Get the information
check the protocol
$ git config get editor
Change the protocol
$ gh config set git_protocol ssh
Create repositories on the repo without leaving the terminal
Create a Repo
$ gh repo create test-1234-gh
If you want to create a repo in your organization
Create a repo under your organization
Cloning a particular repository
$ gh repo clone <oraginization/repo>
It is still showing the URL to which you cannot push or pull to
what you can do it
$ gh repo fork
Check the git repo
gh repo list
Cloning a repo
[root@cmptest01-cc github-cli]# gh repo clone 8x8/auto_jenkins_testing_jenkins-class-1-conf
Cloning into 'auto_jenkins_testing_jenkins-class-1-conf'...
remote: Enumerating objects: 31, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 31 (delta 8), reused 10 (delta 2), pack-reused 0
Unpacking objects: 100% (31/31), done.
Adding to
git remote add <remote-name> <remote-location>[root@cmptest01-cc github-cli]# gh pr checkout feature/new
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 27 (delta 7), reused 10 (delta 2), pack-reused 0
Unpacking objects: 100% (27/27), done.
From https://github.com/8x8/auto_jenkins_testing_jenkins-class-1-conf
* [new branch] feature/new -> origin/feature/new
Branch feature/new set up to track remote branch feature/new from origin.
Switched to a new branch 'feature/new'
==Pull Request
[root@cmptest01-cc github-cli]# gh pr checkout https://github.com/8x8/auto_jenkins_testing_jenkins-class-1-conf.git
no pull requests found for branch "https://github.com/8x8/auto_jenkins_testing_jenkins-class-1-conf.git"







Comments
Post a Comment