[GTALUG] Git question

Scott Elcomb psema4 at gmail.com
Fri Jul 24 01:08:07 UTC 2015


On Wed, Jul 22, 2015 at 4:27 PM, William Muriithi
<william.muriithi at gmail.com> wrote:
> Afternoon
>
> 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.

-- 
  Scott Elcomb         @psema4
  http://psema4.com/pubkey.txt
     http://www.pirateparty.ca/


More information about the talk mailing list