Every time I'm trying to clone a private repo I get the prompt to add my username and password.
I looked around to see what's wrong, because I added my password and didn't work, and found out that I have to use the Personal Access Token. Now every time I'm trying to clone a private repo I have to add that (or generate another) token.
Is there a way to clone a private git repo without the token? Or at least to be able to add my password instead of that token?
Entering Git Username and Password in Remote URL To prevent Git from asking for your username and password, you can enter the login credentials in the URL as shown. The main drawback of this method that your username and password will be saved in the command in the Shell history file.
If Git prompts you for a username and password every time you try to interact with GitHub, you're probably using the HTTPS clone URL for your repository. Using an HTTPS remote URL has some advantages compared with using SSH.
Issue the command git fetch/push/pull. You will not then be prompted for the password.
You can use the git credentials storage for storing your username and passwords while accessing the repository over https.
Run
git config credential.helper store
and then
git pull
This will ask your username and passwords and then remember it for future use. Please note running above commands will create a file at ~/.git-credentials
and store the credentials in plain text which can be a security risk.
An alternative is to store the credentials in memory rather than the disk. To do this you can run the below command.
git config credential.helper 'cache --timeout=3600'
This way git will not any files on disk and use the memory for storing the credentials. the timeout
argument here is used to specify that the credentials should be cached for next 1 hour.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With