在Bash脚本中向Git提供密码

前端之家收集整理的这篇文章主要介绍了在Bash脚本中向Git提供密码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Bash脚本我想提供密码.我尝试过以下方法
echo 'mypass' | git pull

git pull < 'mypass'

git pull < echo 'mypass'

似乎没有工作.

gitcredentials这是答案.

http://git-scm.com/docs/gitcredentials.html

DESCRIPTION

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.

[…]

REQUESTING CREDENTIALS

Without any credential helpers defined,Git will try the following strategies to ask the user for usernames and passwords:

  1. 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.
  2. Otherwise,if the core.askPass configuration variable is set,its value is used as above.
  3. Otherwise,if the SSH_ASKPASS environment variable is set,the user is prompted on the terminal.

[…]

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.

You may also have third-party helpers installed; search for credential-* in the output of git 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 the credential.helper variable.

git help -a | grep credential- *显示以下帮助器:

credential                remote
  credential-cache          remote-ext
  credential-cache--daemon  remote-fd
  credential-osxkeychain    remote-ftp
  credential-store          remote-ftps
原文链接:https://www.f2er.com/bash/383311.html

猜你在找的Bash相关文章