红穆笔记

git credential

用於管理和存儲 Git 用戶憑證(如用戶名和密碼)

100% 瀏覽器本地處理 0 數據上傳

常用示例

獲取憑證信息(從配置文件中讀取用戶名和密碼)

echo "{{url=http://example.com}}" | git credential fill

存儲憑證信息(保存到配置的憑證助手中)

echo "{{url=http://example.com}}" | git credential approve

刪除憑證信息(從所有配置的憑證助手中清除)

echo "{{url=http://example.com}}" | git credential reject

提示:花括號{{…}}是需要替換的參數(路徑、文件名等);命令只在本機終端執行,本站不保存任何輸入。

英文原文對照

展開英文說明與示例(來源 tldr-pages)

Retrieve and store user credentials. More information

Display credential information, retrieving the username and password from configuration files

echo "{{url=http://example.com}}" | git credential fill

Send credential information to all configured credential helpers to store for later use

echo "{{url=http://example.com}}" | git credential approve

Erase the specified credential information from all the configured credential helpers

echo "{{url=http://example.com}}" | git credential reject

命令信息

命令名git credential
用途用於管理和存儲 Git 用戶憑證(如用戶名和密碼)
適用平臺通用
示例數量3 條
官方文檔https://git-scm.com/docs/git-credential
數據來源tldr-pages(CC-BY-4.0)· 社區中文翻譯

常見問題

git credential 命令是做什麼的?

用於管理和存儲 Git 用戶憑證(如用戶名和密碼)

git credential 怎麼用?

頁面按場景列出了3 條常用示例:每條示例先說明用途,再給出可直接複製的完整命令(花括號裏是需要替換的參數)。

git credential 最常用的操作是什麼?

獲取憑證信息(從配置文件中讀取用戶名和密碼):echo "{{url=http://example.com}}" | git credential fill

命令裏的花括號是什麼意思?

花括號{{…}}表示需要替換成你自己的值,例如路徑、文件名;同名參數方括號(如 [-C|--directory])表示可選寫法。