Make sure that you are signed up in your GitHub account on the default browser, if not do so now !
Resynchronize the package index files :
sudo apt update
Install gh :
sudo apt install gh
gh
is available via Homebrew.
Make sure that you have Homebrew installed in your mac to install the below step 👇
Installing through Homebrew :
brew install gh
For more details check Link.
Make sure that you have installed gh
successfully in your pc before starting this step
gh auth login
-
What account do you want to log into?
- GitHub.com (use your up and down keys andenter
) -
What is your preferred protocol for Git operations?
- HTTPS -
Authenticate Git with your GitHub credentials?
- Yes -
How would you like to authenticate GitHub CLI?
- Login with a web browser
There will a one-time code which will be shown (example:xxxx-xxxx), copy the one-time code and enter
Paste the one-time code in the browser page which is opened and authorize.
Once the verificaiton is done you are all set to go :
Make sure that the username of your GitHub is correctly displayed in the terminal.
Logged in as <your-username>