GIT having trouble over SSH server

1,675 views
Skip to first unread message

LocusAsaf

unread,
Jul 14, 2009, 4:01:16 PM7/14/09
to msysGit
Hi everyone,
I've been trying to get my local mSysGIT to recognize remote repo's on
different servers and have found it very difficult. Currently I am
running an SSH server (Bitvise WinSSHD) on my remote machine and it
seems to function properly under all normal circumstances. If I open
a GIT-bash session and 'ssh user@remoteaddress' I it connects me to my
server specified default directory with GIT-bash running on the other
end (also doing stuff like 'ssh usr@ra echo test' works).

However, anytime I run a git remote command such as 'git remote show
remoterepo' or 'git remote push' I got back an error saying "'git-
upload-pack' is not recognized as an internal or external command,
operable program or batch file." To remedy this I added "my\path\to\Git
\libexec\git-core" to my system PATH variable (this is where git-
upload-pack resides on my machine) which corrected the problem of the
the command not being recognized however now I get the error "fatal:
''/d/testgit'' does not appear to be a git repository" (D:\testgit is
the location of my remote bar git repo).

Looking at the log of the SSH server it says "Session channel 1:
Executed command 'git-upload-pack '/d/testgit'' in working directory
'D:\testgit'." This leads me to believe that once GIT connects to the
remote machine it is essentially running "git-upload-pack '/d/
testgit'" in cmd.exe from the directory D:\testgit. To confirm this I
logged onto the server directly (with RDC) opened up cmd.exe and ran
it and got the same error message, so I think I'm correct.

What is interesting to me is the following two facts. If I open up a
BASH session and try 'git-upload-pack /d/testgit' it works, so this is
what GIT expects to work properly. Second, if I open up cmd.exe and
run "git-upload-pack D:\testgit" this also works.

What I'm wondering is, why does git-upload-pack behave different in a
BASH session from a CMD session? I know mSysGit is able to translate
windows paths to unix paths and vice versa, so why doesn't it succeed
in this case as well?

Maybe there is some work-around that will allow me to specify the
remote address as such so that it will avoid the issue all together?
(my .git/config looks as such: "url = ssh://usr@r.a/d/testgit
fetch = +refs/heads/*:refs/remotes/remoterepo/*")

If anyone has any other suggestions please let me know, has anyone
successfully gotten their local mSysGit to interface properly with an
SSH server that they would recommend?

Thanks In Advance Everyone.

Johannes Sixt

unread,
Jul 15, 2009, 2:36:36 PM7/15/09
to LocusAsaf, msy...@googlegroups.com
On Dienstag, 14. Juli 2009, LocusAsaf wrote:
> running an SSH server (Bitvise WinSSHD) on my remote machine and it
> seems to function properly under all normal circumstances. If I open
> a GIT-bash session and 'ssh user@remoteaddress' I it connects me to my
> server specified default directory with GIT-bash running on the other
> end (also doing stuff like 'ssh usr@ra echo test' works).

But 'ssh usr@ra git-upload-pack' does not, right? Make sure your remote end
(ssh server) sets the PATH correctly. When you installed msysgit, it offered
you 3 options how you want to invoke git. One of the options is to modify
PATH permanetly. Perhaps you did not choose that option, but you should have.

> Maybe there is some work-around that will allow me to specify the
> remote address as such so that it will avoid the issue all together?
> (my .git/config looks as such: "url = ssh://usr@r.a/d/testgit
> fetch = +refs/heads/*:refs/remotes/remoterepo/*")

Make that

url = usr@r.a:d:/testgit

It could work.

-- Hannes

LocusAsaf

unread,
Jul 15, 2009, 3:50:25 PM7/15/09
to msysGit
"ssh urs@ra git-upload-pack" does work and that's because I added it
to my system PATH variable. I actually did do the "Modify my PATH"
during GIT installation but I had to manually enter the "my\path\to\Git
\libexec\git-core" because the GIT installation does not do that for
you.

My issue is not that git-upload-pack is not recognized, the issue is
that git-upload-pack is that it's being executed in CMD which can not
translate unix style paths into windows style paths. Therefore....
"ssh urs@ra git-upload-pack c:\path\to\my\bare\repo" works but "ssh
urs@ra git-upload-pack 'c/path/to/my/bare/repo'" the latter being what
GIT is executing once it connects to the the SSH Server.

I am able to change what executable the SSH server runs the GIT
commands in when it connects, therefore what I did was made it run
SH.exe instead of CMD.exe, however this leads to other issues. I
won't go into that since I've already posted this issue in a separate
posting more recently titled "How does sh.exe or bash.exe find GIT
commands (git-upload-pack)." Please respond to that posting if you
feel you can help.

As for trying stuff like "url = u...@r.a:d:/testgit" it doesn't work
as far as I know. I've tried several different ways but it seems that
the url must have unix style paths.

Essentially, I think using cmd.exe to execute git commands remotely is
not going to work because it cannot accept unix style paths and git
remote cannot use windows style paths. That's why I've been going
down using sh.exe instead but as I said this has other issues, and
that is why I posted the new discussion.

Thanks,
Asaf

On Jul 15, 2:36 pm, Johannes Sixt <j...@kdbg.org> wrote:
> On Dienstag, 14. Juli 2009, LocusAsaf wrote:
>
> > running an SSH server (Bitvise WinSSHD) on my remote machine and it
> > seems to function properly under all normal circumstances.  If I open
> > a GIT-bash session and 'ssh user@remoteaddress' I it connects me to my
> > server specified default directory with GIT-bash running on the other
> > end (also doing stuff like 'ssh usr@ra echo test' works).
>
> But 'ssh usr@ra git-upload-pack' does not, right? Make sure your remote end
> (ssh server) sets the PATH correctly. When you installed msysgit, it offered
> you 3 options how you want to invoke git. One of the options is to modify
> PATH permanetly. Perhaps you did not choose that option, but you should have.
>
> > Maybe there is some work-around that will allow me to specify the
> > remote address as such so that it will avoid the issue all together?
> > (my .git/config looks as such: "url = ssh://...@r.a/d/testgit
> > fetch = +refs/heads/*:refs/remotes/remoterepo/*")
>
> Make that
>
>    url = u...@r.a:d:/testgit

Johannes Schindelin

unread,
Jul 16, 2009, 4:32:03 AM7/16/09
to LocusAsaf, msysGit
Dear all,

just a quick reminder: culling the Cc: list and top-posting are considered
poor netiquette, especially on this list.

Ciao,
Dscho


Reply all
Reply to author
Forward
0 new messages