使用ansible将git repo拉到无业游民的盒子

Afzal SH

大家好,我尝试通过ansible将回购从我的github拖到无所事事的盒子中,请参阅此github问题我已经从我的主机向github注册了一个ssh。下面是我要尝试的剧本部分;

  - name: install git
    apt: name=git

  - name: create the ssh public key file
    copy: src=/home/user/.ssh/id_rsa.pub dest=/root/.ssh/id_rsa.pub mode=0644

  - name: create the ssh private key file
    copy: src=/home/user/.ssh/id_rsa dest=/root/.ssh/id_rsa mode=0600

  - name: setup git repo
    git: [email protected]:myusername/project_foo_bar.git dest=/home/projects/myproject accept_hostkey=yes key_file="/root/.ssh/id_rsa"

安装git之后,我已将我的公钥和私钥复制到该框中,但是在最后一步中,我的配置失败。我无法拉回购协议,而是出现以下错误;

TASK: [setup git repo] ******************************************************** 
failed: [default] => {"cmd": "/usr/bin/git ls-remote origin -h     refs/heads/master", "failed": true, "rc": 128}
stderr: fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

msg: fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

FATAL: all hosts have already failed -- aborting

我输入的地址错误吗?我尝试过repo=ssh://[email protected]/myusername/project_foo_bar.git但是也不会飞

阿力克

您在/home/projects/myproject目录中初始化一个存储库,然后尝试将github存储库克隆到相同的目录中。

删除init任务,/home/projects/myproject从框中删除目录,然后再次运行您的剧本。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章