[GTALUG] Git question

William Muriithi william.muriithi at gmail.com
Fri Jul 24 11:58:26 UTC 2015


Morning

> > I have a git repo called configurations. I want to add the directory /etc/ansible to the repo.
> >
> > Problem is when I clone the repo, I am not able to commit the ansible directory as the ansible root directory is outside the repo?
> >
> > Is there a way of getting the ansible directory into git without using a symlink?
>
> Would a pre-commit hook to copy the config files into your repo
> (before committing) do what you need?
>
> [- snippet starts -]
> # create or append /path/to/repo/.git/hooks/pre-commit
>
> cp -r /etc/ansible ./etc/ansible
> git add ./etc/ansible
>
> [- snippet ends -]
>
> If this strategy works for you, you might want to keep a copy of the
> pre-commit file in your repo and just symlink to it from .git/hooks -
> just be sure to note the pre-commit symlink in your README for other
> any other (or future) developers.
This will work for me.  Tried it yesterday and its working fine.
Thanks a lot guys for the various idea

Regards,

William


More information about the talk mailing list