git credential-cache (Git) - Git 中文開發手冊
名稱
git-credential-cache - Helper 臨時將密碼存儲在內存中
概要
git config credential.helper 'cache [options]'
Description
該命令將內存中的憑證緩存供將來的 Git 程序使用。存儲的憑證永遠不會觸及磁盤,並在可配置的超時后被遺忘。緩存可通過 Unix 域套接字進行訪問,通過文件系統權限僅限於當前用戶。
你可能不想直接調用這個命令;它意味着被 Git 的其他部分用作憑證助手。請參閱 gitcredentials [7]或EXAMPLES以下。
選項
--timeout
緩存憑據的秒數(默認值:900)。
--socket
使用
控制daemon(守護進程)
如果您希望守護進程提前退出,並在所有緩存的憑據超時前忘記,則可以執行以下exit操作:
git credential-cache exit
示例
這個 helper 的重點是減少你輸入用戶名或密碼的次數。例如:
$ git config credential.helper cache $ git push http://example.com/repo.git Username:Password: [work for 5 more minutes] $ git push http://example.com/repo.git [your credentials are used automatically]
您可以通過 credential.helper 配置變量提供選項(此示例將緩存時間降低到5分鍾):
$ git config credential.helper 'cache --timeout=300'Git 中文開發手冊