Skip to content

Conversation

@gregnrobinson
Copy link

Problem Code

the stock git-clone V0.4 doesn't seem to leverage the ssh-privatekey unless it's added to a keychain.
This has worked for me.  It needs to be verified and once it has should be PRd upstream.
eval `ssh-agent -s`
ssh-add ${PARAM_USER_HOME}/.ssh/ssh-privatekey

My SSH Secret

Name:         tkn-ssh-credentials
Namespace:    e595b8-dev
Labels:       <none>
Annotations:  <none>

Type:  Opaque

Data
====
id_rsa:  2635 bytes

I think the problem is because my key is named id_rsa which removes the requirement for the steps you are adding. By default, Linux will search for id_rsa when connecting to a remote host using ssh. Because your key is named otherwise, it creates this necessity to add it as an alternative identity. Info on doing this is below. I would recommend just naming it id_rsa and calling it a day. No need to complicate things.

For info on id_rsa default naming, you can look here: https://askubuntu.com/questions/30788/does-ssh-key-need-to-be-named-id-rsa.

Using multiple keys

It's not uncommon to use multiple keys. Instead of running ssh user@host -i /path/to/identity_file, you can use a configuration file, ~/.ssh/config.

Common settings are the IdentityFile (the keys) and port. The next configuration will check "id_dsa" and "bender" only when connecting with ssh youruser@yourhost:

Host yourhost
   IdentityFile ~/.ssh/id_dsa
   IdentityFile ~/.ssh/bender

If you omit Host yourhost, the settings will apply to all SSH connections. Other options can also be specified for this host match, like User youruser, Port 2222, etc. This would allow you to connect with the shorthand ssh yourhost instead of ssh -p2222 youruser@yourhost -i ~/.ssh/id_dsa -i ~/.ssh/bender.

Reference

More Info

@bashbang
Copy link
Owner

I've updated my secret and added a id_rsa with the same value as ssh-privatekey then re-ran my testing pipeline and that solved the issue. So you're correct, having the default searched file of "id_rsa" results in a valid key for ssh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants