Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. 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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 0.8.0
    • None
    • None
    • Windows 7, MsysGit 1.8.0

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              uzr somebody
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: