Search code examples
gitgithubgit-clonegithub-cli

Does cloning a repo using Github CLI use HTTPS or SSH?


I am a member of a GitHub org that requires pushes to be done through SSH, so when I clone down repos I need to use the syntax git clone [email protected]:<ORG>/<REPO>.git.

I am migrating over to using the GitHub CLI more and more now, and have just noticed the new(ish) option on GitHub to "Clone with GitHub CLI" (gh repo clone <ORG>/<REPO>). Does this use SSH or HTTPS to clone? As far as I can tell, the official docs don't specify.


Solution

  • Further digging shows that the default git_protocol is HTTPS.

    You can override this to use ssh by default with gh config set git_protocol ssh and check that it has worked by viewing the output of gh config get git_protocol.