To git clone with a password, simply enter the git account’s username and you will be requested for the password.
git clone https://username@<repo_url>
For example, to clone your repository from Github with a password, use the following command.
git clone https://similargeeks@github.com/<username>/<repo>.git
Password for ‘https://similargeeks@github.com’: *******
Using the above way, you would have to enter the account password every time you wish to push or pull code from the server.
Fortunately, you can set your password so that you are not prompted again. Simply execute git config
with the credential.helper
option to enable the credentials helper.
git config --global credential.helper store
Your credentials will get stored in the home directory at ~/.git-credentials
.
Also Read:
How to Clone Single Branch in Git Repo