Reputation: 83
Here Git push requires username and password I read how pushing/pulling to/from github do not enter login/passowrd any time running git command in command line.
I found next :
git config --global credential.helper 'cache --timeout 7200'
After enabling credential caching, it will be cached for 7200 seconds (2 hour).
I decided that 2 hours too small and tried to set cach 200 hours with command :
git config --global credential.helper 'cache --timeout 7200000'
I have Ubuntu 18 both at my local server and on remote server.
But when I run github next day(I think 10-12 hours passed) it did not work.
Does this cache option has some hours restrictions or what is the problem ?
Thanks!
Upvotes: 6
Views: 8801
Reputation: 700
Based on your comment, it seems that caching works correctly on your server (that is rarely restarted), but not your laptop (which is frequently restarted).
The documentation for git-credential-cache says this:
This command caches credentials in memory for use by future Git programs. The stored credentials never touch the disk, and are forgotten after a configurable timeout.
Since the credentials are stored in memory only, it makes sense that you would lose them whenever you restart. Given that, I can think of a few workarounds for this:
Upvotes: 6