在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

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...