2015-07-21 29 views
0

大家好,我试图从我的github回拉到回流浪盒通过ansible,参考this github issue回购。我用github从我的主机注册了一个ssh。下面是我试图拉动剧本的部分;拉动git回购使用ansible的流浪盒

- 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但这也不会飞

+0

你为什么要在'/ home/projects/myproject'中初始化一个仓库? – Alik

+0

@Alik我刚刚开始使用安全和流浪两种方式。假定这是必需的。现在我知道了,错误保持不变。丁认为这是理由,但谢谢你。 –

+0

你是否从包装盒中删除了'/ home/projects/myproject'文件夹? – Alik

回答

1

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

删除初始化任务,从框中删除/home/projects/myproject目录并再次运行您的剧本。