bsky
bsky

Reputation: 20222

Connecting to Jenkins with ssh key

I want to use the Jenkins CLI, and for that I think that I need to generate an SSH key pair on my machine and put the public key of that pair in the Jenkins server configuration.

I generated an SSH key on my machine with ssh-keygen -t rsa -b 4096 -C "[email protected]" and I'm trying to give the public key to the Jenkins server.

However, if I go to Jenkins -> Credentials -> System -> Global Credentials, the only SSH-related option is SSH Username with private key.

Shouldn't it ask for an SSH public key instead of a private key?

Am I making any mistakes in my assumptions?

Upvotes: 2

Views: 13950

Answers (2)

Kozmotronik
Kozmotronik

Reputation: 2520

New path to set the SSH public key as of 2024 is:
Your Username > Security > SSH Public Keys

Upvotes: 0

Christopher Orr
Christopher Orr

Reputation: 111555

You need to add the public key to your user account in Jenkins.

Click your username in the top-right of any page in Jenkins, click Configure in the sidebar, and there you'll find a SSH Public Key textfield to paste into.

Upvotes: 7

Related Questions