SCM Setup - invalid privatekey

411 views
Skip to first unread message

Tracy Walker

unread,
Feb 8, 2019, 8:04:46 PM2/8/19
to rundeck-discuss
I’m having an issue setting up SCM for a project with this error: `Failed fetch from the repository: g...@github.com:myusername/subdir.git: invalid privatekey:`
I’ve followed github’s instructions for creating, adding, and testing my ssh key against my github account.  I can successfully authenticate with my key against Github via the terminal.  I've restarted my containers.
My Git URL is copied directly from the repository (ssh).
I've added the public key to github.
I've added the private key to the Rundeck keystore.
I've selected the SSH Key Storage Path to be the correct key.  What else could I be doing wrong?

Thank you! ;)

rac...@rundeck.com

unread,
Feb 9, 2019, 4:52:28 PM2/9/19
to rundeck-discuss
HI Tracy,

What kind of keys do you use? Rundeck use JSCH  implementation and support this keys: ssh-dss, ssh-rsa, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384 and ecdsa-sha2-nistp521.

You can see more about JSCH here: http://www.jcraft.com/jsch/

Another option that you have is configuring SCM with HTTPS using a GitHub Token.

Greetings!

Tracy Walker

unread,
Feb 9, 2019, 6:38:11 PM2/9/19
to rundeck-discuss
Thank you for the quick reply!
 
I believe I am using a ssh-rsa key. The command I used to generate the SSH key was ssh-keygen -t rsa -b 4096 -C "my_e...@emailaddress.com"
I successfully used github's instructions for generating, adding the key to the ssh-agent, and testing from my mac command line.

Error.png

I also tried with a fresh key without the -b 4096, but receive the exact same message:  

Is it possible that successfully testing the key from the command line on my mac doesn't imply the same private key will work from within rundeck docker container?

I considered the HTTPS option, but I would rather understand & learn what I'm doing wrong with this approach. Thank you again!

Itasdfasdflkj

rac...@rundeck.com

unread,
Feb 11, 2019, 12:05:47 PM2/11/19
to rundeck-discuss
Hi Tracy,

You can pass the key to container using:

$ docker run --name some-rundeck -v /home/protip/.ssh:/home/rundeck/.ssh rundeck/rundeck

Check that:

https://hub.docker.com/r/rundeck/rundeck/#ssh-keys

Another option that you have is run the container on interactive and terminal mode (passing -i and -t options) and check/set your private key.

Please consider:

1) Make sure that GitHub public key match with your private key (you can set it in: https://github.com/settings/keys).
2) Also, set "false" the "SSH: Strict Host Key Checking" option in SCM configuration.

Hope it helps!

rac...@rundeck.com

unread,
Feb 12, 2019, 10:11:09 AM2/12/19
to rundeck-discuss
I followed this steps and works for me:

1) Generate new key with:

ssh-keygen -t rsa -b 4096

2) You can see the two new files (keys) in .ssh directory: id_rsa (private) and id_rsa.pub (public)

3) In GitHub upload your public key (Settings -> SSH and GPG keys -> New SSH Key button)

4) Start container passing the private key generated recently:

docker run -p 4440:4440 --name mycontainer-v /your/user/path/.ssh:/home/rundeck/.ssh rundeck/rundeck:3.0.13

5) In Rundeck, go to Key Storage and add the private key (important: including the first line "-----BEGIN RSA PRIVATE KEY-----" and the last line "-----END RSA PRIVATE KEY-----" ).

6) Go to your project > Project Settings > Setup SCM

    Tips for export configuration:
        a) Make sure that "Committer Name" field is your user in GitHub.
        b) Make sure that "Committer Email is the Email to be used in "Primary email address", something like "45257294...@users.noreply.github.com"
        c) In "SSH: Strict Host Key Checking" set "no", tht avoid the host key verification.
        d) In "SSH Key Storage Path" select the key saved on Key Storage.

Also you can try it using native Rundeck (without step 4) instead docker container to test and discard a specific Docker issue.

Hope it helps!

On Friday, February 8, 2019 at 10:04:46 PM UTC-3, Tracy Walker wrote:

Tracy Walker

unread,
Feb 12, 2019, 10:25:01 AM2/12/19
to rundeck-discuss
I will try this ASAP!  :) . Thank you!
Reply all
Reply to author
Forward
0 new messages