mathoug
mathoug

Reputation: 31

Git clone on windows : [email protected] is not a git command

I'm trying to clone a repository the ssh way from github and another form gitlab

I'm on windows EDIT : with Git v 2.29.2.2

I'm getting the following error, which I do not understand from what it is coming from :

$ git clone [email protected]:math-gallou/AI21_TPs.git
Cloning into 'AI21_TPs'...
git: '[email protected]' is not a git command. See 'git --help'.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

So I also tried :

$ git clone "ssh://[email protected]:math-gallou/AI21_TPs.git"

and

$ git clone ssh://[email protected]:math-gallou/AI21_TPs.git

But the same exact error comes out.

When I do the ssh -v [email protected] I can connect with success.

So what did I miss ?

Upvotes: 3

Views: 4263

Answers (3)

Aim Tao
Aim Tao

Reputation: 1

Update your git maybe help you! I solved the problem by using git update.

Upvotes: 0

An07
An07

Reputation: 111

In my case, I defined system environment variable GIT_SSH to use openssh I installed, and then git is broken and I got git: '[email protected]' is not a git command. See 'git --help'..

After deleting system environment variable GIT_SSH everything works again.

Then I tried to define user environment variable GIT_SSH and restart system (I didn't restart system in previous try), somehow now my git works correctly with openssh I installed. I don't know which part is wrong in my previous try but I decide not to waste more time on this.

Upvotes: 0

VonC
VonC

Reputation: 1329472

First, if you are trying the ssh:// syntax, then the URL would be:

git clone ssh://[email protected]/math-gallou/AI21_TPs.git
                            ^^^ /, not :

Second, check if you have a %USERPROFILE%\.ssh\config file with a github.com Host entry in it, whose content might be incorrect or mis-interpreted.

Upvotes: 1

Related Questions