I know how to provide a username and password to an HTTPS request like this:

git clone https://username:password@remote

But I’d like to know how to provide a username and password to the remote like this:

git clone git@remote.git

I’ve tried like this:

git clone username:password@git@remote.git
git clone git@username:password@remote.git
git clone git@remote.git@username:password

But they haven’t worked.

12 s
12

Based on Michael Scharf’s comment:

You can leave out the password so that it won’t be logged in your Bash history file:

git clone https://username@github.com/username/repository.git

It will prompt you for your password.

Alternatively, you may use:

git clone https://username:password@github.com/username/repository.git

This way worked for me from a GitHub repository.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *