亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
characters

命名

gitcredentials  - 為 Git 提供用戶名和密碼

概要

git config credential.https://example.com.username myusername
git config credential.helper "$helper $options"

描述

Git 有時需要用戶的證書才能執(zhí)行操作; 例如,它可能需要詢問用戶名和密碼才能通過 HTTP 訪問遠程存儲庫。本手冊描述了 Git 用于請求這些憑證的機制,以及一些避免重復輸入這些憑證的功能。

請求憑證

沒有定義任何憑證助手,Git 會嘗試使用以下策略來詢問用戶的用戶名和密碼:

1. 如果GIT_ASKPASS設置了環(huán)境變量,則調用該變量指定的程序。在命令行上向程序提供適當?shù)奶崾?,并從標準輸出中讀取用戶的輸入。

2. 否則,如果core.askPass配置變量被設置,則其值如上使用。

3. 否則,如果SSH_ASKPASS設置了環(huán)境變量,則其值如上使用。

4. 否則,在終端上提示用戶。

避免重復

一遍又一遍地輸入相同的憑證可能會很麻煩。Git 提供了兩種方法來減輕這種煩惱:

1. 給定認證上下文的用戶名的靜態(tài)配置。

2. 憑據(jù)助手緩存或存儲密碼,或與系統(tǒng)密碼錢包或鑰匙串進行交互。

如果您沒有可用于密碼的安全存儲,則第一種方法很簡單且適用。通常通過將此添加到您的配置來進行配置:

[credential "https://example.com"]
        username = me

另一方面,憑證助手是 Git 可以從中請求用戶名和密碼的外部程序; 它們通常與操作系統(tǒng)或其他程序提供的安全存儲接口。

要使用助手,您必須先選擇一個使用。Git 目前包含以下幫助程序:

cache

將內存中的憑據(jù)緩存一段時間。有關詳細信息,請參閱 git-credential-cache [1] 。

store

無限期地將憑證存儲在磁盤上。有關詳細信息,請參閱 git-credential-store [1] 。

您也可能安裝了第三方助手; credential-*在輸出中搜索git help -a,并查閱單個助手的文檔。一旦你選擇了一個助手,你可以通過把它的名字放入 credential.helper 變量來告訴 Git 使用它。

1. 尋找?guī)褪帧? git help -a | grep credential- credential-foo

2. 閱讀它的描述。

$ git help credential-foo

3. 告訴 Git 使用它。

$ git config --global credential.helper foo

憑據(jù)上下文

Git 認為每個憑證都有一個由 URL 定義的上下文。此上下文用于查找特定于上下文的配置,并傳遞給任何助手,這些助手可將其用作安全存儲的索引。

例如,假設我們正在訪問https://example.com/foo.git。當 Git 查看配置文件以查看某個節(jié)是否與此上下文相匹配時,如果上下文是配置文件中模式的更具體子集,它將認為這兩個匹配。例如,如果你在你的配置文件中有這個:

[credential "https://example.com"]
        username = foo

那么我們將匹配:兩個協(xié)議是相同的,兩個主機都是相同的,并且“模式” URL 完全不關心路徑組件。但是,這種上下文不匹配:

[credential "https://kernel.org"]
        username = foo

因為主機名稱不同。它也不會匹配foo.example.com; Git 完全比較主機名,而不考慮兩臺主機是否屬于同一個域。同樣,一個配置項http://example.com不匹配:Git 完全比較協(xié)議。

配置選項

憑證上下文的選項可以配置為credential.*(適用于所有憑證),或者credential.<url>.* <url> 與上述的上下文匹配。

以下選項可在任一位置使用:

helper

外部憑證助手的名稱以及任何關聯(lián)的選項。如果幫助程序名稱不是絕對路徑,則該字符串git credential-被前置。得到的字符串由 shell 執(zhí)行(例如,設置foo --option=bar它將git credential-foo --option=bar通過 shell 執(zhí)行。有關它們的使用示例,請參閱特定幫助程序的手冊。

如果credential.helper配置變量有多個實例,則會依次嘗試每個助手,并可能提供用戶名,密碼或任何內容。一旦 Git 獲得用戶名和密碼,就不會再嘗試更多的助手。

如果credential.helper配置為空字符串,則會將幫助程序列表重置為空(因此您可以通過配置空字符串幫助程序,隨后選擇任意一組幫助程序來覆蓋由較低優(yōu)先級配置文件設置的幫助程序)。

username

默認的用戶名,如果沒有在 URL 中提供。

useHttpPath

默認情況下,Git 不認為 http URL 的“路徑”組件值得通過外部助手進行匹配。這意味著存儲的憑證https://example.com/foo.git也將被用于https://example.com/bar.git。如果您想?yún)^(qū)分這些情況,請將此選項設置為true。

自定義助手

您可以編寫自己的自定義助手來與您保存憑據(jù)的任何系統(tǒng)進行交互。有關詳細信息,請參閱 Git 憑據(jù) API 的文檔。

Previous article: Next article: