I have Teamcity build agent, where I need to extract the git log
from a repository. The trouble is, when my shell script runs, it's not in git repository, so git log
doesn't work out of the box.
Does anyone know how to achieve this.
I have search the documentation, but I can't seem to find any way of doing it.
Problem solving so far
When Teamcity "clones" a project from Github on to the agent, it doesn't actually clone the whole thing. So the working directory
is not a repository.
I do not have SSH access to github when running my shell script, which I need
Thanks in advance.
Solution
See accepted answer below.
Use the -C
flag of the git
command. It allows you to specify the git directory.
git -C 'git-working-dir' log