Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ansible Sparse Checkout
---
- hosts: all
vars:
repo_url: ssh://git@github.com/user/repo.git
base_dir: /var/www
sparse_checkout:
- folder1
tasks:
- name: prepare sparse git repository
shell: |
git init
git config core.sparsecheckout true
git remote add origin {{ repo_url }}
args:
chdir: "{{ base_dir }}"
creates: "{{ base_dir }}/.git"
- name: configure sparse-checkout
copy:
dest: "{{ base_dir }}/.git/info/sparse-checkout"
content: '{{ sparse_checkout | join("\n") }}'
- name: clone code
shell: git pull origin master
args:
chdir: "{{ base_dir }}"
creates: "{{ base_dir }}/{{ sparse_checkout | first }}"
@akashbhaskar2907

This comment has been minimized.

Copy link

akashbhaskar2907 commented Apr 16, 2019

It asked for username and password at "clone code" step. How to configure it so that I dont have to manually enter username and password?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.