加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在Bash脚本中向Git提供密码

发布时间:2020-12-16 01:33:17 所属栏目:安全 来源:网络整理
导读:从 Bash脚本我想提供密码.我尝试过以下方法: echo 'mypass' | git pullgit pull 'mypass'git pull echo 'mypass' 似乎没有工作. gitcredentials这是答案. http://git-scm.com/docs/gitcredentials.html DESCRIPTION Git will sometimes need credentials fr
从 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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读