Skip to content

Got your code working against a private repo #1

@gregnrobinson

Description

@gregnrobinson

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

I will make a pull request with all changes if it permits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions