使用 ansible 将 git repo 拉到一个 vagrant box
Pulling git repo to a vagrant box using ansible
大家好,我正在尝试通过 ansible 从我的 github 将一个 repo 拉到一个 vagrant box,参考 this github issue。我已经从我的主机向 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 后,我已将我的 public 和私钥复制到盒子中,但我的配置在最后一步失败了。我无法提取回购协议,而是收到以下错误;
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 存储库克隆到同一目录。
删除初始化任务,从框中删除 /home/projects/myproject
目录并再次 运行 您的剧本。
大家好,我正在尝试通过 ansible 从我的 github 将一个 repo 拉到一个 vagrant box,参考 this github issue。我已经从我的主机向 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 后,我已将我的 public 和私钥复制到盒子中,但我的配置在最后一步失败了。我无法提取回购协议,而是收到以下错误;
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 存储库克隆到同一目录。
删除初始化任务,从框中删除 /home/projects/myproject
目录并再次 运行 您的剧本。