1

I try to use apache commons-exec to run git clone command but stuck, it did not prompt me with password input at all and block there.

DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler( new PumpStreamHandler( System.out, System.err, System.in ) );
executor.execute( "git clone --progress -v https://xxx/prj.git" );

Any ideas to solve this?

1 Answer 1

1

I figure out a way to work around this problem, just wrap the user name and passwd as inputstream:

String input="...";        
executor.setStreamHandler( new PumpStreamHandler( System.out, System.err, new ByteArrayInputStream(
            input.getBytes() ) ) );
Sign up to request clarification or add additional context in comments.

1 Comment

What is the input string format in this case? Do you know if this works for git pull?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.