sshd.setPort( port );
if ( !certDir.exists() ) {
certDir.mkdirs();
}
sshd.setKeyPairProvider( new SimpleGeneratorHostKeyProvider( new File( certDir, "hostkey.ser" ).getAbsolutePath() ) );
sshd.setCommandFactory( new CommandFactory() {
public Command createCommand( String command ) {
if ( command.startsWith( "git-upload-pack" ) ) {
return new GitUploadCommand( command, repositoryResolver, getAuthorizationManager() );
} else if ( command.startsWith( "git-receive-pack" ) ) {
return new GitReceiveCommand( command, repositoryResolver, getAuthorizationManager(), receivePackFactory );