簡體   English   中英

如何使用Ansible git模塊克隆空的裸存儲庫?

[英]How do I clone an empty bare repository with Ansible git module?

我有一個空的裸存儲庫,我正在嘗試使用Ansible克隆,但git模塊正在嘗試檢出master並因此失敗,因為在空的repo中沒有這樣的refspec。

我唯一的方法是使用shell命令來克隆repo。

我嘗試過各種方式,唯一有效的方法是添加ignore_errors: true然后檢查是什么讓Ansible模塊失敗。 我知道它不是最佳的,但它有效,我們不會讓所有的錯誤通過:

- git: repo=<YOUR REPO> dest=<DEST>
  ignore_errors: true
  register: output
- name: check the error that failed the git module
  fail: msg="{{ output.msg }}"
  when: "'Failed to checkout branch master' not in output.msg"

順便說一句,我過濾了output.msg而不是output.stderr因為出於某種原因,它出現在.msg而不是.stderr

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM