You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2013/07/23 13:32:48 UTC

[jira] [Commented] (SSHD-201) Using git over sshd requires custom parsing of the command and removal of characters to work, however this custom parsing will likely break other applications going though the sshserver

    [ https://issues.apache.org/jira/browse/SSHD-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13716319#comment-13716319 ] 

Guillaume Nodet commented on SSHD-201:
--------------------------------------

The previous comment refers to another issue, please ignore it.

It seems to me that this issue is caused by invoking git in the windows environment.
One thing that may work better would be to use a custom ProcessShellFactory which would start a cygwin env and call git from there I suppose.
Another possibility would be to have the shell factory invoking a shell script dealing with the arguments split / replacement of '/'.
A last possibility would be to use a native java git client using jgit for example.

I'm going to investigate a bit, but I'm not quite sure if there's much we can do from sshd here, but eventually to provide a ProcessShellFactory dedicated to cygwin.

                
> Using git over sshd requires custom parsing of the command and removal of characters to work, however this custom parsing will likely break other applications going though the sshserver
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SSHD-201
>                 URL: https://issues.apache.org/jira/browse/SSHD-201
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>         Environment: Windows 7, MsysGit 1.8.0
>            Reporter: somebody
>
> I have two git repositories on windows 7, locally for now as a testing step. When I set my git remote url with the following:
> git remote set-url origin "ssh://test@localhost:22/C/gittest"
> it does not work though the sshd server using mina sshd. Git says:
> fatal: ''/C/gittest'' does not appear to be a git repository
> fatal: Could not read from remote repository.
> Please make sure you have the correct access rights
> and the repository exists.
> however this same url works fine with an ssh server running on windows 7 using copssh.
> The only way I was able to get this to work with mina sshd was to set the url as follows:
> git remote set-url origin "ssh://test@localhost:22/C:\gittest"
> However this was not enough, I also had to manually parse out the "/" at the beginning of the command and the extra single quotes at the beginning and end of the command in the sshserver.  This parsing should not be necessary.  Perhaps i'm doing something wrong, but playing with the shell type etc did not lead anywhere.
> I use the following code for handling the commands which I found online in how to use sshd:
> sshServer = SshServer.setUpDefaultServer();
> ...
>       CommandFactory myCommandFactory = new CommandFactory() {
>          @Override
>          public Command createCommand(String command) {
>             String[] commandArray = command.split(" ");
>              //here i iterate over the command array and remove the "/" and extra "'" from the second item
>            Command result = new ProcessShellFactory(commandArray).create();
>             return result;
>          }
>       };
> sshServer.setCommandFactory(new ScpCommandFactory(myCommandFactory));
> I should not have to do manual altering of the commands on the server side in this arbitrary way as this will likely not work for other ssh commands i send to the server.
> Please try to fix this before the next version of sshd.  It is very critical for my use cases.  And thank you very much for making this library.  I have been looking for something like this for a long time.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira