I have provisioned a server with ansible and now I would like to clone a private git repo (not github).
So my local machine's ssh key is authorized on the private git repo and what I have done up till now is copy my local public and private ssh key to the server.
But I feel this is not the best way to go about it.
I know if you are using github you can use the API to create a deploy key. But I am not.
So the only other way I can see is:
- Generate ssh key-pair on new server
- Copy that newly created ssh key-pair locally with
fetch ssh-copy-idor useauthorized_keysto add the servers key to the private git repo
Is there something I am missing, can it be done in another easier way?