How to remember username and password in https or http mode of git

Original text: http://www.cnblogs.com/wish123/p/3937851.html
The https method requires you to enter the password every time. You can enter it once according to the following settings, so you don't have to enter the password by hand, and you can enjoy the benefits brought by https. Extremely fast

Set remember password (default 15 minutes):

git config --global credential.helper cache
If you want to set the time yourself, you can do this:

git config credential.helper 'cache --timeout=3600'
will invalidate after one hour

Long-term storage of passwords:

git config –global credential.helper store
It is also possible to bring a password when adding a remote address. (recommend)

http://yourname:[email protected]/name/project.git
Supplement: Passwords can also be stored using the client.

If you are using ssh and want to experience the high speed brought by https, then you can do this: Switch to the project directory:

cd projectfile/
remove the warehouse address in remote ssh mode

git remote rm origin
adds https remote warehouse address

git remote add origin http://yourname:[email protected]/name/project.git
搞定,enjoy the speed!
详见:http://git.oschina.net/oschina/git-osc/issues/2586

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325444833&siteId=291194637
Recommended