6

So I want to push my local repo to my remote repo on github.com but the problem is that I everytime I generate a new SSH Key and add a it to my account. it doesn't work, then I tried searching through documentations and found out that I have to start my ssh-agent first. but when I do

eval $(ssh-agent -s) it returns bash: ssh-agent: command not found

OS: Windows 10 (I'm using Git bash)

OishikG
  • 69
  • 1
  • 6
  • 1
    You need to install `ssh-agent` before you can use it. – Charles Duffy Jan 29 '22 at 04:23
  • Also, on Windows, think about using Pageant (the PuTTY SSH agent) instead, and telling git to use `plink` (PuTTY's interface amenable to programmable use). See https://stackoverflow.com/questions/35110079/git-bash-and-pageant-are-not-using-keys describing how to accomplish both these things -- that way other Windows tools (not just PuTTY but also WinSCP f/e) will also be able to use your key. – Charles Duffy Jan 29 '22 at 04:23
  • @CharlesDuffy ah thank you! but that's a little strange considering the fact that it worked before. – OishikG Jan 29 '22 at 04:26
  • Did you mention in the question that it had worked in the past? Anyhow -- check if you have a `ssh-agent.exe` somewhere on your system, and if it does exist, make sure it's in your PATH. (That said, I use Pageant myself on the rare occasions when I have no choice but to work on Windows, and do continue to suggest that you do likewise; you get a tray icon and otherwise generally better platform integration). – Charles Duffy Jan 29 '22 at 05:03

2 Answers2

1

The ssh-agent is only needed if you have generated a private key with a passphrase.

Try ssh -Tv git@github.com to see where ssh.exe would search your key.

And make sure C:\Program Files\Git\usr\bin is in your %PATH%, since both ssh.exe and ssh-keygen.exe are there.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
-1

You need to add quotes.

eval "$(ssh-agent -s)"
CM777
  • 431
  • 5
  • 5