【问题标题】:Ansible: "Permission denied (publickey)" when using git moduleAnsible:使用 git 模块时“权限被拒绝(公钥)”
【发布时间】:2017-01-27 07:33:28
【问题描述】:

我正在尝试在我的 Ansible 剧本中执行 git clone 命令。它看起来像这样:

- name: a play that runs entirely on the ansible host
  hosts: 127.0.0.1
  connection: local
  tasks:
  - name: check out a git repository
    git: repo={{ repo_url }} dest=/Dest/For/Cloning/ accept_hostkey=yes
    vars:
      repo_url: git@github.com:lorin/mezzanine-example.git

而且,我的 cfg 文件如下所示:

[defaults]
transport = ssh

[ssh_connection]
ssh_args= -A

但是,当我运行命令:ansible-playbook -i "localhost," -c local GitClone.yaml 时,我收到了 Permission denied (publickey) 错误。

我想将一个 gh 存储库克隆到我的本地 [指定文件路径]。

【问题讨论】:

标签: git github ansible


【解决方案1】:

这看起来你想克隆别人的公共仓库并且可能永远不会推回 GitHub。

您不需要为此提供 GitHub 凭据,因此只需使用 HTTPS 传输:

repo_url: https://github.com/lorin/mezzanine-example.git

附带说明:当您在ansible-playbook 调用中使用-c local 时,您会覆盖ansible.cfg 中的transport 设置。您的示例文件中的设置将被忽略。

【讨论】:

  • 谢谢。 :) 。有效。我如何为自己的回购做这件事?我会继续努力。
猜你喜欢
  • 2021-11-11
  • 2014-03-18
  • 1970-01-01
  • 2019-12-16
  • 2017-09-07
  • 1970-01-01
  • 2020-01-04
  • 2013-11-08
相关资源
最近更新 更多