{"thread":{"id":"15359","subject":"Calling ssh from git-gui","startedAt":"2008-09-03T16:54:55Z","lastAt":"2008-09-03T17:33:10Z","messageCount":5,"participants":["Petr Baudis","Shawn O. Pearce","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"89646","messageId":"20080903165455.GU10544@machine.or.cz","threadId":"15359","inReplyTo":null,"subject":"Calling ssh from git-gui","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-09-03T16:54:55Z","receivedAt":"2008-09-03T16:54:55Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"  Hi,\n\n  I'm quite at loss by now searching for a reasonable solution for\ninvoking ssh (either directly or through git fetch/git push) from\ngit-gui, which is very problematic right now - doubly so when\nconsidering both UNIX and Win32.\n\n  There are several scenarios to consider:\n\n  (i) SSH to known host with key managed by a running agent.\n  (ii) SSH to host without agent running or without keys set up.\n  (iii) SSH to unknown host (unregistered fingerprint).\n\n  Currently, (i) is the only scenario git-gui can handle, which means\nthat users usually have to use Other Means (tm) to \"seed\" their ssh tool\n(OpenSSH or PuTTY) - it forces them to install keys and manually connect\nto the machine once. Furthermore, this is pretty much undocumented (and\neven if it was, GUI users assume they don't have to read documentation)\nand there is no way to give the user feedback why on the earth is the\nthing hanging.\n\n  Handling (ii) and (iii) unfortunately turned out to be very tricky.\n\n  On Linux, things are at least manageable - running ssh in a separate\nsession and setting $SSH_ASKPASS to point at a GUI helper should do.\n(Even though the separate session part might get rather tricky to\nimplement in TCL.) On Windows, there is PuTTY and OpenSSH to consider:\n\n  With PuTTY, I know about no good solutions for both (ii) and (iii)\nshort of including PuTTY code with custom frontend in msysGit itself -\nthis might be interesting approach, though. PuTTY is licenced under\nsomething that looks like an MIT licence and can run on UNIX too.\n\n  With OpenSSH, I was not able to get $SSH_ASKPASS to work, even after\ngoing through the ordeal of setting up msysdvlpr and compiling my own\nsetsid.exe - setsid.exe cat /dev/tty shows it does not exist, yet\nOpenSSH still declines to call $SSH_ASKPASS. By now, I'm at loss and\nrunning out of time to investigate this further.\n\n\n  To sum it up, there are two possible solutions to driving ssh through\ngit-gui:\n\n  * Call setsid'd ssh with $SSH_ASKPASS; this might get very tricky to\nimplement in TCL. Either git-gui.sh could execute wish setsid'd already\n(which is probably not portable and changes current semantics as git-gui\ndetaches from the current terminal, but that could be ok), or Git itself\ncould get support of setsid()ing before calling ssh (probably better\noption). To get this working on Win32 would require further work and\npossibly ssh or msys code hacking. (Heck, we could customize the ssh we\nship with msysGit to remove the braindead no-controlling-terminal\nrequirement.)\n\n  * Use PuTTY code with custom frontend for the ssh transport. This is\nprobably not realistic since I can't think of any benefits this would\nget non-Win32 users now - though for Win32 users the benefits might be\nsignificant; making embedding-friendly PuTTY frontend (not even\nnecessarily git-specific) could be nic next year's GSoC project\ncandidate?\n\n\n  Comments, thoughts?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nThe next generation of interesting software will be done\non the Macintosh, not the IBM PC.  -- Bill Gates\n"},{"id":"89651","messageId":"20080903171543.GC28315@spearce.org","threadId":"15359","inReplyTo":"20080903165455.GU10544@machine.or.cz","subject":"Re: Calling ssh from git-gui","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-03T17:15:43Z","receivedAt":"2008-09-03T17:15:43Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Petr Baudis <pasky@suse.cz> wrote:\n> \n>   I'm quite at loss by now searching for a reasonable solution for\n> invoking ssh (either directly or through git fetch/git push) from\n> git-gui, which is very problematic right now - doubly so when\n> considering both UNIX and Win32.\n> \n>   There are several scenarios to consider:\n> \n>   (i) SSH to known host with key managed by a running agent.\n>   (ii) SSH to host without agent running or without keys set up.\n>   (iii) SSH to unknown host (unregistered fingerprint).\n> \n>   Currently, (i) is the only scenario git-gui can handle, [...]\n> \n>   Handling (ii) and (iii) unfortunately turned out to be very tricky.\n\nAnd that is why it doesn't handle (ii) or (iii) at the present time,\nand unless I am given a nice patch series for any git-gui related\nparts of this, why it will continue to remain that way for quite\nsome time.\n\nIts annoying, and people complain about it, but I know of no good\nsolution here, and neither it seems does anyone else.  :-|\n\nAt prior day-job I had a customized git-gui starting an rxvt on\nCygwin to run some in-house command line scripts, which in turn\ncalled git fetch and git push.  These worked just fine obviously in\nan rxvt, it was a full tty that SSH could interact with the user on.\n\nDamn annoying for git-gui to be invoking a new terminal window, but\nmaybe that's what we have to do.  Be nice though if the window only\nwas opened because we couldn't do \"git ls-remote url\" but its hard\nto tell \"hanging because SSH needs the user\" and \"hanging because\nthe network is a 2400 baud modem\".\n\n-- \nShawn.\n"},{"id":"89652","messageId":"200809031922.07083.trast@student.ethz.ch","threadId":"15359","inReplyTo":"20080903171543.GC28315@spearce.org","subject":"Re: Calling ssh from git-gui","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2008-09-03T17:22:04Z","receivedAt":"2008-09-03T17:22:04Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Shawn O. Pearce wrote:\n> Damn annoying for git-gui to be invoking a new terminal window, but\n> maybe that's what we have to do.  Be nice though if the window only\n> was opened because we couldn't do \"git ls-remote url\" but its hard\n> to tell \"hanging because SSH needs the user\" and \"hanging because\n> the network is a 2400 baud modem\".\n\nYou can set BatchMode (ssh_config(5)) to at least prevent it from\nhanging, can't you?\n\n- Thomas\n\n-- \nThomas Rast\ntrast@student.ethz.ch\n\n\n"},{"id":"89653","messageId":"20080903172541.GD28315@spearce.org","threadId":"15359","inReplyTo":"200809031922.07083.trast@student.ethz.ch","subject":"Re: Calling ssh from git-gui","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-03T17:25:41Z","receivedAt":"2008-09-03T17:25:41Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Thomas Rast <trast@student.ethz.ch> wrote:\n> Shawn O. Pearce wrote:\n> > Damn annoying for git-gui to be invoking a new terminal window, but\n> > maybe that's what we have to do.  Be nice though if the window only\n> > was opened because we couldn't do \"git ls-remote url\" but its hard\n> > to tell \"hanging because SSH needs the user\" and \"hanging because\n> > the network is a 2400 baud modem\".\n> \n> You can set BatchMode (ssh_config(5)) to at least prevent it from\n> hanging, can't you?\n\nTrue, but this is OpenSSH specific, and has to be done on the\ncommand line, which git-gui has no control over.\n\nMaybe git fetch and push can check for a tty on fd 0 and enable\ntry to enable batch mode if fd 0 isn't a tty?\n\n-- \nShawn.\n"},{"id":"89654","messageId":"20080903173310.GY10360@machine.or.cz","threadId":"15359","inReplyTo":"20080903171543.GC28315@spearce.org","subject":"Re: Calling ssh from git-gui","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-09-03T17:33:10Z","receivedAt":"2008-09-03T17:33:10Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Wed, Sep 03, 2008 at 10:15:43AM -0700, Shawn O. Pearce wrote:\n> And that is why it doesn't handle (ii) or (iii) at the present time,\n> and unless I am given a nice patch series for any git-gui related\n> parts of this, why it will continue to remain that way for quite\n> some time.\n\nMy writeup was not actually intended as 'how we might do it' but 'how\nshould *I* implement this'. ;-) I _do_ plan for a nice patch series.\nFor now I'm defaulting on the SSH_ASKPASS approach.\n\n> Damn annoying for git-gui to be invoking a new terminal window, but\n> maybe that's what we have to do.  Be nice though if the window only\n> was opened because we couldn't do \"git ls-remote url\" but its hard\n> to tell \"hanging because SSH needs the user\" and \"hanging because\n> the network is a 2400 baud modem\".\n\nOh, indeed - that is something what I had in mind when starting to write\nthis mail about a week ago, but forgot to mention now. It's the\npossibility of having console spawn a real tty (or do some more stuff to\n*emulate* a tty, but again, this might get hairy in TCL). However, this\nfeels very... \"untidy\" compared to SSH_ASKPASS.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nThe next generation of interesting software will be done\non the Macintosh, not the IBM PC.  -- Bill Gates\n"}]}