Posh-Git throwing ssh error while trying to pull from origin

139 Views Asked by At

I'm unable to pull from origin when using posh-git module. Is there a way to configure my existing ssh keys location with posh-git to use them? The native git works fine.

Error Details:

C:\Git\MyRepo [master ≡]
> git pull origin master

    Could not create directory '/h//.ssh'.
    The authenticity of host 'domain.net (10.a.b.xyz)' can't be established.
    ECDSA key fingerprint is SHA256:nxxxx.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Failed to add the host to the list of known hosts (/h/.ssh/known_hosts).
    [email protected]: Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
1

There are 1 best solutions below

2
On

I did the following to check my home path using powershell,

Command: $env:HOME
Output:  H:\

But I didn't have any H:\ drive in my computer, so I updated it to my home directory where my .ssh folder is located.

Command: [Environment]::SetEnvironmentVariable("HOME", "C:\Users\<UserName>", "User")

It worked after I have completely closed and re-opened powershell :)