Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How do I change the route cmder has to find ssh keys? #2930

Open
2 tasks done
DarioArDi opened this issue Mar 19, 2024 · 10 comments
Open
2 tasks done

Question: How do I change the route cmder has to find ssh keys? #2930

DarioArDi opened this issue Mar 19, 2024 · 10 comments

Comments

@DarioArDi
Copy link

Question

Right now it searches in "~/.ssh "but i would like to put a relative path to not have to copy my keys in the home directory of every computer that I use instead of geting them from the external drive.
I have searched everywhere, I tried looking at user_profile.cmd, start-ssh-agent.cmd and init.bat.

Checklist

  • I have read the documentation and made sure what I'm looking for isn't present, or is unclear.
  • I have searched for similar issues, and either this question wasn't asked before, or I didn't find any that describe my question.
@DarioArDi
Copy link
Author

By asking Claude 3 (AI) this are the steps.

  1. Go to Settings...
  2. Go to Startup -> Tasks
  3. In {bash::bash} (the one that I am using) I added in the commands

set HOME=%CMDER_ROOT%.ssh
set SSH_USER_HOME=%CMDER_ROOT%.ssh

I added a .ssh folder to the cmder root with the keys.

@daxgames
Copy link
Member

daxgames commented Apr 11, 2024

Yeah I would not do it that way.

Cmder has init scripts you can add that stuff to in your case it would be $CMDER_ROOT/config/user_profile.sh

Add:

export SSH_USER_HOME="$CMDER_ROOT/.ssh"

or whatever else you need to configure in your env.

You could also look at $CMDER_ROOT/config/profile.d and just drop a *.sh|cmd|ps1 file to customize bash|cmd|or powershell sessions.

@chrisant996
Copy link
Contributor

Yeah the AI made up a bad answer, LOL.

@DarioArDi
Copy link
Author

Yeah I would not do it that way.

Cmder has init scripts you can add that stuff to in your case it would be $CMDER_ROOT/config/user_profile.sh

Add:

export SSH_USER_HOME="$CMDER_ROOT/.ssh"

or whatever else you need to configure in your env.

You could also look at $CMDER_ROOT/config/profile.d and just drop a *.sh|cmd|ps1 file to customize bash|cmd|or powershell sessions.

It does not recognise export as a command.

Yeah, I did not test it well and in fact, it does not work

@DarioArDi DarioArDi reopened this Apr 11, 2024
@daxgames
Copy link
Member

daxgames commented Apr 11, 2024

If you edited $CMDER_ROOT/config/user_profile.sh and are using bash::bash then export is indeed a valid command.

@DarioArDi
Copy link
Author

apparently i am using cmd::Cmder

@daxgames
Copy link
Member

For cmd::cmder edit %CMDER_ROOT%/config/user_profile.cmd and use set instead of export.

You can also do the same for PowerShell::PowerShell by editing $env:CMDER_ROOT\config\user_profile.ps1.

$env:SSH_USER_HOME = "$env:CMDER_ROOT\.ssh"

@DarioArDi
Copy link
Author

I tried that, and it does not give me an error message, but it wont add the keys. I checked start-ssh-agent.cmd and SSH_USER_HOME does not appear anywhere.
I can't find what to change in there to set the path.

@daxgames
Copy link
Member

I never said what you were trying to do would actually work. I have never even considered moving my ~/.ssh folder as it is against well established convention.

I was just trying to tell you how to properly set env variables for various shells supported by Cmder.

You may have to make a copy of the script you mentioned and edit it to do what you need.

@DarioArDi
Copy link
Author

Ok, I need this to work in orther to have a portable working git with ssh keys so I don't have to copy my keys everywhere.

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

No branches or pull requests

3 participants