If you like the command line, you need to enter the password each time to pull and submit. If you are not using SSH
In the following example, no account password is entered in HTTP https mode. No matter whether it is submitted or pulled, it will be automatically recorded and saved once it is set.
Create a file that stores the user name and password
In the home folder, create a file under c: \ Documents ents and Settings \ administrator. git-credentials (cannot be directly created in windows. so there is a trick: first create a file named) git-credentials and then enter git bash using the command:
[Plain]
View plaincopy
- MV Git-credentials. Git-Credentials
Open the file in notepad and enter:
[SQL]
View plaincopy
- Https: // {username }:{ password} @ github.com
For example:
[Plain]
View plaincopy
- Https: // zhangsan: 123456@github.com
Save
Add config item
Right-click any folder and choose git bash.
Then enter:
[Plain]
View plaincopy
- Git config -- Global credential. helper store
After the execution is complete, check the c: \ Documents ents and Settings \ Administrator \. gitconfig file and find one more:
[Plain]
View plaincopy
- [Credential]
- Helper = store
It is successful.
Re-open the GIT bash window, and then submit it without entering the username and password.
Reference: Git-Credential-Cache (1) manual pagename
Git-Credential-Cache-helper to temporarily store passwords in memory
Synopsis
git config credential.helper 'cache [options]'
Description
This command caches credentials in memory for use by future git programs. The stored credentials never touch the disk, and are forgotten after a dead able timeout. The cache is accessible over a Unix domain
Socket, restricted to the current user by filesystem permissions.
You probably don't want to invoke this command directly; it is meant to be used as a credential helper by other parts of git. seegitcredentials (7) orExamplesBelow.
Options
-
-- Timeout <seconds>
-
Number of seconds to cache credentials (default: 900 ).
-
-- Socket <path>
-
Use<Path>To contact a running cache daemon (or start a new cache daemon if one is not started). defaults~ /. Git-Credential-Cache/socket. If your home
Directory is on a network-mounted filesystem, you may need to change this to a local filesystem.
Controlling the daemon
If you wowould like the daemon to exit early, forgetting all cached credentials before their timeout, you can issueExitAction:
git credential-cache exit
Examples
The point of this helper is to reduce the number of times you must type your username or password. For example:
$ git config credential.helper cache$ git push http://example.com/repo.gitUsername: <type your username>Password: <type your password>[work for 5 more minutes]$ git push http://example.com/repo.git[your credentials are used automatically]
You can provide options via the credential. helper configuration variable (this example drops the cache time to 5 minutes ):
$ git config credential.helper 'cache --timeout=300'
Source: http://blog.csdn.net/nsrainbow/article/details/9121131