You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "somebody (JIRA)" <ji...@apache.org> on 2012/12/17 13:52:12 UTC

[jira] [Created] (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

somebody created SSHD-201:
-----------------------------

             Summary: 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