大家好,我正在尝试通过 ansible 将 repo 从我的 github 拉到一个 vagrant box,参考这个 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: 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
了,但这也不行