1

I wish to clone the Git repo using ssh URL using shell script as a part of automation.

So need to pass the username and password in the clone command.

How to pass the username and password in the same line.

For HTTP/HTTPS based URL I have passed the username, password in the clone command in the script, it works fine. But for ssh based URL it is not.

General SSH based clone command which I'm using:

git clone ssh://{user}@{host}:{port}/{repo}

2

1 Answer 1

2
sshpass -p password git clone ssh://{user}@{host}:{port}/{repo}
Sign up to request clarification or add additional context in comments.

Comments

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.