Retrieve git information from within an application

I am developing an application for issue tracking and I want to do the following:

  1. User provides the git base url to an activity (that has issues) like this: host_ip:/git/repository/path
  2. Each time an issue page is shown, there will be a link that will show the commits made to the repository with a message containing the issue key.

In my development env I have it working because I execute something like:

git --git-dir /git/repository/path log --all --grep=foo

but this will not be the case when I deploy it to production.

I want to execute the command above but with a path that is not in the server the application is hosted.
Any ideas?

Git Baby is a git and github fan, let's start git clone.