Skip to content

GitHub Client Requires Username to Clone Even Authenticated


I Installed the GitHub client and authenticated with https using gh auth login. But when I am trying to clone a repository, it prompt me to input username and password for like the following,

root@vm:~# gh repo clone <repo>
Cloning into '<repo>'...
Username for '':

I can't understand why it needs input username.


From github cli repository issue list I found the solution, that it needs to set authentication for git.

In my case, I need to set for https authentication like,

gh config set git_protocol https -h
gh auth setup-git

If you use ssh, the you may need to set for ssh like,

gh config set git_protocol ssh -h
gh ssh-key add ~/.ssh/<my-key>.pub