The documentation on configuring SSH access mentions that it is a must to add the “add_ssh_keys” in our job that we want to use a key in. However I was able to do this without having the same in my config file. How is this possible? And why do we need “add_ssh_keys” then?
Welcome to the community, @darkknight97!
I’m not sure I follow your question.
- If you mean SSHing into the build environment , then we fetch the SSH key on file from the VCS provider (e.g., Bitbucket and GitHub) so you don’t need to configure or run anything in the config.
If you’re talking about making use of an SSH key inside the environment , that’s what the
add_ssh_keysconfig is for. The use case is if from inside the box, you need to use some SSH key to do something else (like deploying to yet another box somewhere else).
Let me know if this helps or you have more questions!
I mean the second use case “making use of an SSH key inside the environment”. I need to send my code to an EC2 instance using rsync and CircleCI docs say that I need to use the
add_ssh_keys config to add the keys to the box. However, I was able to do the rsync even without
add_ssh_keys. So I was curious as to what its purpose was.
If you were able to do the rsync without the
add_ssh_keys step, there’s a couple possibilities. One is that you might be using your personal SSH key, which is automatically added to the box without any additional config. Otherwise, it seems like there might be something strange in your security settings. I can’t think of any other way it would work, but any other details you find would be interesting to hear about!
What do you mean by personal SSH key though?
Nevertheless I am only using a key that was generated was for this purpose alone and I have only added it to Project Settings. It however works without add_ssh_keys.