I have a git remote repository and a username and password on it.
When I clone my repo, Because it has many sub repo inner. For each time I have to enter my username and password.
I can oly read from git server.
How do I store permanently my username and password for using remote repo?

- 2,845
- 6
- 47
- 67
-
4Does this answer your question? [How can I save username and password in Git?](https://stackoverflow.com/questions/35942754/how-can-i-save-username-and-password-in-git) – Oliver Lorton Jan 05 '22 at 06:38
2 Answers
You can add your ssh key to the ssh-agent. This will remember the ssh password so that you no longer have to enter it in each time. See the GitHub documentation on how to do this: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent

- 709
- 1
- 6
- 21
You can use
git config --global credential.helper store
Or execute the following command in a terminal to configure the git credential helper in cache mode,
git config --global credential.helper cache
“gitcredentials” module is used to request these credentials from the user as well as stores these credentials to avoid inputting these credentials repeatedly.
By default, the git credentials in the “store” mode will be stored in the “.git-credentials” file in the user’s home directory (~/.git-credentials)
In Windows the path is C:\Users\<username>\.git-credentials
In Mac and Linux the path is /Users/<username>/.git-credentials
For more information and options you can read this essay or this document on git-scm.com

- 729
- 3
- 7