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

Looks for .ssh folder in wrong location? #61

Closed
jumoel opened this issue Jun 17, 2012 · 8 comments
Closed

Looks for .ssh folder in wrong location? #61

jumoel opened this issue Jun 17, 2012 · 8 comments

Comments

@jumoel
Copy link

jumoel commented Jun 17, 2012

(I'm posting this here, because GitHub said I should - I encountered this issue when launching the console from the GitHub for Windows app)

I (used to) use MsysGit, which looks in %HOME% for the .ssh folder. posh-git looks in %HOMEPATH%. This leads to two different .ssh folders.

Could posh-git be changed, so it looks for the .ssh-folder in %HOME% if this variable is present and falls back to %HOMEPATH% if it isn't? That way the transition from MsysGit to posh-git (or the use of both) would be a lot easier.

@dahlbyk
Copy link
Owner

dahlbyk commented Jun 18, 2012

I try to mimic what msysGit does, using existing HOME first, otherwise falling back on HOMEPATH or USERPROFILE: https://github.com/dahlbyk/posh-git/blob/master/posh-git.psm1#L13-14

https://github.com/msysgit/msysgit/blob/devel/etc/profile#L48-54
https://github.com/msysgit/msysgit/blob/devel/cmd/git.cmd#L9-10

I wonder if those lines need to appear earlier in posh-git.psm1 - can you try moving them right after the first line?

@DerAlbertCom
Copy link
Contributor

See #73

@dahlbyk
Copy link
Owner

dahlbyk commented Jan 22, 2013

Now that #73 has been merged, can you try latest and see if this fixes your issue?

@rkeithhill
Copy link
Collaborator

I have changed this to use PowerShell's built-in $HOME variable, which isn't itself an env var; however it is derived from the env vars %HOMEDRIVE%%HOMEPATH%.

In PowerShell ~ is the same as $HOME except when you are located in a provider other than the filesystem e.g.:

12> cd cert:
\
13> resolve-path ~  | fl *
resolve-path : Home location for this provider is not set. To set the home location, call "(get-psprovider
'Certificate').Home = 'path'".
At line:1 char:1
+ resolve-path ~  | fl *
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Resolve-Path], PSInvalidOperationException
    + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.ResolvePathCommand

So it is better to avoid ~ if possible. However I'm curious how msysGit seems to work better with just %HOMEPATH% i.e. the home path sans drive name - \users\keith?

Is msysGit more *nixy and not like drive specifiers? If so, we could search $Home first and if .ssh is not found there, then we could search $Home with the drive specified stripped off.

@dahlbyk
Copy link
Owner

dahlbyk commented Jan 6, 2017

I had forgotten the module still includes:

if (!$Env:HOME) { $Env:HOME = "$Env:HOMEDRIVE$Env:HOMEPATH" }
if (!$Env:HOME) { $Env:HOME = "$Env:USERPROFILE" }

So really it should be pretty safe to use $Env:HOME instead of $Home to align with Git/MSYS.

Is msysGit more *nixy and not like drive specifiers?

Yeah, in Git Bash you will see /c/Windows instead of C:\Windows.

@dahlbyk dahlbyk added this to the SSH Agents milestone Jan 6, 2017
@rkeithhill
Copy link
Collaborator

I think 0.7.0 should resolve this but I don't run msysGit, so I can't test if it really is fixed.

@dahlbyk
Copy link
Owner

dahlbyk commented Feb 7, 2017

I don't run msysGit, so I can't test if it really is fixed.

msysGit of 2012 is what we now call Git for Windows.

At this point I'm basically content to let SSH issues sit (as if I hadn't been before 🙄) until someone gets fed up enough to spin off a project for it (#338).

@rkeithhill
Copy link
Collaborator

SSH functionality has been spun off into the posh-sshell module (https://github.com/dahlbyk/posh-sshell) so closing this issue.

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

4 participants