我试图在我的Ansible playbook中执行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 repo到我的本地[指定文件路径]。
I am trying to execute a git clone command in my Ansible playbook. It looks like this:
- 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.gitAnd, my cfg file looks like this:
[defaults] transport = ssh [ssh_connection] ssh_args= -AHowever, when I'm running the command: ansible-playbook -i "localhost," -c local GitClone.yaml, I get the Permission denied (publickey) error.
I want to clone a gh repo to my local[specified file path].
最满意答案
这看起来像你想克隆其他人的公共回购,可能永远不会回到GitHub。
您无需为此提供GitHub凭据,因此只需使用HTTPS传输:
repo_url: https://github.com/lorin/mezzanine-example.git作为旁注:当您在ansible-playbook调用中使用-c local ,您将覆盖ansible.cfg transport设置。 您的示例文件中的设置将被忽略。
This looks like you want to clone someone else's public repo and likely never to push back to GitHub.
You don't need to provide GitHub credentials for that, so just use the HTTPS transport:
repo_url: https://github.com/lorin/mezzanine-example.gitAs a side note: when you use -c local in the ansible-playbook call you override transport settings from the ansible.cfg. Settings in your example file are ignored.
更多推荐
发布评论