gitgithubdeploy-keys

How to clone repo using deploy key?


I successfully created a deploy key for a private repository using the method outlined here.

Now when I run git clone repo_url I would expect it to clone? But it doesn't. A pop up appears expecting git credentials (standard email/password1). Where have I gone wrong? I can cat my_rsa_key and see that it has been created successfully (saved to the default location).

Perhaps I have missed something or do I have to clone the repo using a different command?

1 Which defeats the purpose of having the deploy key in the first place

Note

I am on windows server 2019


Solution

  • You are probably trying to clone the repo using https rather than ssh. When you click on "Clone or download" on github, you can choose ssh, which is the only way your deploy key will be used.