I know how to include a username and password in an HTTPS Git URL like this:
git clone https://username:password@host
But I’d like to know how to provide a username and password to an SSH remote like this:
git clone git@host.git
I’ve tried like this:
git clone username:password@git@host.git
git clone git@username:password@host.git
git clone git@host.git@username:password
But they haven’t worked.
Based on Michael Scharf’s comment:
You can leave out the password, so that it won’t be logged in your Bash history file:
It will prompt you for your password.
Alternatively, you may use:
This way worked for me from a GitHub repository.