Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-67534

"invalid format" error when pasting SSH private key without armor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ssh-credentials-plugin
    • None
    • Jenkins 2.289.2 with SSH Credentials 1.19 and Git plugin 4.10.1.

      Pasting a private SSH key in the Jenkins credentials page, and omitting the delimitting comment lines such as: ----- BEGIN OPENSSH PRIVATE KEY ----- causes the key to not work, with an error message such as:

      Failed to connect to repository : Command "git ls-remote -h -- ssh://user:@host:port/project HEAD" returned status code 128:[...]
      Load key "/tmp/jenkins-gitclient-ssh14352756356499154328.key": invalid format user@host: Permission denied (publickey). fatal: Could not read from remote repository.
      Please make sure you have the correct access rightsand the repository exists.
      

      Repasting the private key with both the top and bottom delimitting lines ----- BEGIN OPENSSH PRIVATE KEY -----, the error vanishes.

      I'd expect it to work without these lines which are comments, AFAIK.  If they are somehow necessary, then the tool should fail early, at the time the user input the key text.

            jvz Matt Sicker
            apteryx3 M C
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: