PostgreSQL coub express.js freeware git jquery laravel links linux macos mysql node.js php powershell python ubuntu vim virtualbox анекдот блог игры интересно стихи цитаты

powershell + ssh agent (+git rem)
August 02, 2024
Usual error in ps console looks like this
Starting ssh-agent on Windows 10 fails: "unable to start ssh-agent service, error :1058"

Let's fix this
> Get-Service ssh-agent

Status   Name               DisplayName
------   ----               -----------
Stopped  ssh-agent          OpenSSH Authentication Agent
Then check that the service has been disabled by running

Take a look on startup type
> Get-Service ssh-agent | Select StartType

StartType
---------
Disabled

Admin privileges needed
> Get-Service -Name ssh-agent | Set-Service -StartupType Manual

Next, let's start this one and check
> Start-Service ssh-agent

> Get-Service ssh-agent

Status   Name               DisplayName
------   ----               -----------
Running  ssh-agent          OpenSSH Authentication Agent

Original solution is here

REM
In case you always have password request on git pull/push even you have already added (ssh-add ~/.ssh/my-key-file-name) your ssh secret key, you have to set up environment variable for Win10
Name    |  Value
----------------
GIT_SSH |  C:\Windows\System32\OpenSSH\ssh.exe   
Or, set up your personal ssh path if needed.

May be useful
$HOME\.ssh\config example (for sure you need to set up your own hostname, user & key file name)
Host github.com
    HostName github.com
    User git
    PreferredAuthentications publickey
    AddKeysToAgent yes
    IdentityFile ~/.ssh/my-gh-private-key

In case you want to force passsword you can set up host like this
Host my-host.com
    HostName my-host.com
    User my_login
    PreferredAuthentications password

+ Useful commands
ssh-add -l # show added keyfiles
ssh-add -D # delete added keys

Start-Service ssh-agent # Admin access needed
Stop-Service ssh-agent  # Admin access needed

Comments

No comments here yet.
You have to login to post a new comment.
aghr