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

1.8k views Asked by At

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.

1

There are 1 answers

0
James Whiteley On BEST ANSWER

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.