On Tue, Oct 04, 2022 at 10:51:48AM -0700, Philippe Couas wrote:

> > > I use git 2.37 on Windows 10 and i have an problem with git clone ssh
> > > 
> > > This command is Ok
> > > 
> > > ssh g...@127.0.0.1 -v -p 2223 -i Z:\zpoubelle\tssh4\id_rsa
> > > But following command failed
> > > 
> > > set GIT_SSH_COMMAND="ssh -p2223-i Z:\zpoubelle\tssh4\id_rsa"
> > > git clone g...@127.0.0.1:2223/srv/git/your-repo.git 
> > <http://git@127.0.0.1:2223/srv/git/your-repo.git> --verbose
> > > 
> > > "ssh -p2223-i Z:\zpoubelle\tssh4\id_rsa": line 1: ssh -p2223-i 
> > > Z:\zpoubelle\tssh4\id_rsa: No such file or directory
> >
> > Note that you have inadvertently glued "-p", "2223" and "-i" together, so
> > ssh receives a command which is passed a "-p2223-i" command-line argument
> > which it supposedly does not know how to interpret.
> >
> i have same problem with set GIT_SSH_COMMAND="ssh -p 2223 -i 
> Z:\zpoubelle\tssh4\id_rsa"

OK, let me have another guess.

The ssh invocation you've done manually, and which worked, was supposedly done
in a Git Bash console, and _may be_ this somehow affects the way the
Windows-native pathname Z:\blah\balah\... is interpreted.

I would try to set GIT_SSH_COMMAND to

  ssh -p 2223 -i /z/zpoubelle/tssh4/id_rsa

and see if it helps.


Well, and another guess.
Actually, the error message

| "ssh -p2223-i Z:\zpoubelle\tssh4\id_rsa": line 1: ssh -p2223-i 
|   Z:\zpoubelle\tssh4\id_rsa: No such file or directory

(single line wrapped) looks very strange: as if the whole string starting
with "ssh" and ending with "id_rsa" is interpreted as the pathname of a
command to execute, which brings me to the next idea.

The thing is, Git supports two environment variables to affect the way it
invokes the SSH client: an older one GIT_SSH and a newer one GIT_SSH_COMMAND.
The difference is that they are interpreted differently: the text in GIT_SSH
is taken to name a single external executable to execute while the contents of
the latter is taken to be a shell script and is interpreted by the shell -
hence allowing to actually specify a command with separate arguments.

The observed behavior looks like as if you have the GIT_SSH set and
GIT_SSH_COMMAND _not_ set, so that Git takes the contents of the former and
interprets "ssh -p 2223 -i Z:\blah\blah..." as the name of an executable which
it obviously cannot find.

How this could happen? This is a tricky question.

One possibility, is that there's a system- or user-level variable GIT_SSH,
and you're setting GIT_SSH_COMMAND in a shell in a way so that it's not
inherited by the processes spawned by the shell - that is, you do not export
the variable using

  export GIT_SSH_COMMAND

...And by the way, what shell are you using to run these Git commands?

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/20221006090221.zjhpayuoooewvtbd%40carbon.

Reply via email to