Git
English ▾ 主題 ▾ 最新版本 ▾ git-credential-cache 上次更新於 2.43.0

名稱

git-credential-cache - 輔助程式,用於暫時將密碼儲存在記憶體中

概要

git config credential.helper 'cache [<options>]'

描述

此命令會快取憑證,供未來 Git 程式使用。儲存的憑證會保存在快取守護進程的記憶體中(而不是寫入檔案),並且會在可設定的逾時時間後被遺忘。如果快取守護進程死掉,例如系統重新啟動,憑證會更快被遺忘。快取可以透過 Unix 網域通訊端存取,並且透過檔案系統權限限制為目前的用戶。

您可能不想直接調用此命令;它旨在作為 Git 其他部分的憑證輔助程式使用。請參閱 gitcredentials[7] 或下方的 範例

選項

--timeout <秒數>

快取憑證的秒數 (預設值: 900)。

--socket <路徑>

使用 <路徑> 連接正在執行的快取守護進程(如果沒有啟動,則會啟動新的快取守護進程)。預設值為 $XDG_CACHE_HOME/git/credential/socket,除非存在 ~/.git-credential-cache/,否則會改用 ~/.git-credential-cache/socket。如果您的主目錄位於網路掛載的檔案系統上,您可能需要將其變更為本機檔案系統。您必須指定絕對路徑。

控制守護進程

如果您希望守護進程提早退出,並在逾時之前遺忘所有快取的憑證,您可以發出 exit 動作

git credential-cache exit

範例

此輔助程式的目的是減少您必須輸入使用者名稱或密碼的次數。例如

$ git config credential.helper cache
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>

[work for 5 more minutes]
$ git push http://example.com/repo.git
[your credentials are used automatically]

您可以透過 credential.helper 配置變數提供選項 (此範例將快取時間增加到 1 小時)

$ git config credential.helper 'cache --timeout=3600'

GIT

屬於 git[1] 套件的一部分

scroll-to-top