Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git command could not be found and could not find ssh-agent

I was on GitHub today and realized I was behind on updates from a repo. I tried to fetch updates, but it failed from the outset. I received two messages when I started up Git Shell (from GitHub for Windows):

Warning: git command could not be found. Please create an alias or add it to your PATH.

Warning: Could not find ssh-agent.

When I attempted to enter "$ git fetch origin", I got the following error message:

The term '$' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I also tried omitting the $ sign, but that didn't change anything.

I have no clue what's going on, the last time I used the Shell (beginning of this month), it did not do this. I have tried adding the path to git.exe to the PATH environment variable, but that did not work - nothing appeared to change. I have not restarted my computer after doing so, is that the problem? I have also never set up Git to use SSH.

like image 549
Seabody Avatar asked Feb 19 '13 05:02

Seabody


People also ask

How do I find my ssh-agent key?

Open TerminalTerminalGit Bash. Enter ls -al ~/. ssh to see if existing SSH keys are present. Check the directory listing to see if you already have a public SSH key.

What is ssh-agent in git?

ssh-agent is a program that starts when you log in and stores your private keys. For it to work properly, it needs to be running and have a copy of your private key. First, make sure that ssh-agent is running with: eval "$(ssh-agent -s)" # for Mac and Linux. or: eval `ssh-agent -s` ssh-agent -s # for Windows.


1 Answers

It sounds like you recently updated GitHub application and Git Shell is now broken.

Short version

To fix it

  • close Git Shell
  • open GitHub and let it do some post installation.
  • Open Git Shell again and you should be fixed.

Long version

This just happened to me and just to make sure I follow you, you just did this

  • Open Git Shell
  • You are prompted to update GitHub
  • After the update, Git Shell opens

Now it gives the error

git command could not be found. Please create an alias or add it to your PATH.

Warning: Could not find ssh-agent.

If this is the case, do this

  • Close Git Shell
  • Now open the GitHub application (not Git Shell).

This will say something along the lines of (not sure of the exact version)

GitHub is extracting git..

Let that go through the process and after it is complete, go open Git Shell and it is fixed. Just worked for me at least.

like image 176
Kirk Avatar answered Oct 20 '22 13:10

Kirk