使用ansible将git仓库拉到一个流浪箱



大家好,我正试图通过visible将repo从我的github拉到一个流浪箱,参考这个github问题。我已经注册了一个ssh从我的主机与github。下面是剧本中我试图拉动的部分;

  - 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: repo=git@github.com: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://git@github.com/myusername/project_foo_bar.git,但这也不飞

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

删除init任务,从box中删除/home/projects/myproject目录,并再次运行剧本

相关内容

  • 没有找到相关文章

最新更新