Skip to content

Instantly share code, notes, and snippets.

@Klice
Created February 8, 2021 23:26
Show Gist options
  • Save Klice/7282c73b3b6f154ff30930f26240fa41 to your computer and use it in GitHub Desktop.
Save Klice/7282c73b3b6f154ff30930f26240fa41 to your computer and use it in GitHub Desktop.
Goorvy script to set SSH key for jenkins admin user
import hudson.model.User
import org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl
User admin = User.getById("admin", false);
UserPropertyImpl adminUserSSHKey = new UserPropertyImpl("some_key_here")
admin.addProperty(adminUserSSHKey);
admin.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment