2015-07-21 59 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目錄並再次運行您的劇本。