cli: gh repo clone is not working with private repositories

Describe the bug

Version 0.8.0. I am trying to clone private repositories but I get an error

Steps to reproduce the behavior

  1. Run the command gh repo clone username/private-repo
  2. Output is an error

Expected vs actual behavior

Expected to be able to clone a private repository.

Logs

Cloning into 'private-repo'...
remote: Repository not found.
fatal: repository 'https://github.com/morbec/private-repo.git/' not found
exit status 128

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 15 (3 by maintainers)

Most upvoted comments

@ushakov-31293 I managed to clone a private repo this way: 1/ generate a ssh key 2/ Add the ssh key to your github account 3/ set the protocol of gh to be ssh gh config set git_protocol ssh 4/ clone using this syntax gh clone repo git@github.com:xxx/yyy.git where xxx is your github username and yyy your repository name

In my case - doesn’t work, neither ssh nor https.

repository not found

Why is SSH necessary to clone private repos?

Hi @vilmibm ,

Good news! It is not a bug! 😃

After executing gh config set git_protocol ssh I was able to clone my private repositories.

Thank you for your help!