从
Bash脚本我想提供密码.我尝试过以下方法:
echo 'mypass' | git pull git pull < 'mypass' git pull < echo 'mypass'@H_404_3@似乎没有工作.
gitcredentials这是答案.
@H_404_3@http://git-scm.com/docs/gitcredentials.html
@H_404_3@DESCRIPTION @H_404_3@Git will sometimes need credentials from the user in order to perform operations; for example,it may need to ask for a username and password in order to access a remote repository over HTTP. This manual describes the mechanisms Git uses to request these credentials,as well as some features to avoid inputting these credentials repeatedly.@H_404_3@[…]
@H_404_3@REQUESTING CREDENTIALS @H_404_3@Without any credential helpers defined,Git will try the following strategies to ask the user for usernames and passwords:@H_404_3@[…]
- If the
GIT_ASKPASS
environment variable is set,the program specified by the variable is invoked. A suitable prompt is provided to the program on the command line,and the user’s input is read from its standard output.- Otherwise,if the
core.askPass
configuration variable is set,its value is used as above.- Otherwise,if the
SSH_ASKPASS
environment variable is set,the user is prompted on the terminal.
@H_404_3@Credential helpers,on the other hand,are external programs from which Git can request both usernames and passwords; they typically interface with secure storage provided by the OS or other programs. @H_404_3@You may also have third-party helpers installed; search for@H_404_3@git help -a | grep credential- *显示以下帮助器:credential-*
in the output ofgit help -a
,and consult the documentation of individual helpers. Once you have selected a helper,you can tell Git to use it by putting its name into thecredential.helper
variable.
credential remote credential-cache remote-ext credential-cache--daemon remote-fd credential-osxkeychain remote-ftp credential-store remote-ftps