0

I'm writing a post-receive hook and looking to dynamically set the repo location to a variable.

The post-receive hook is located in: /git/hub/poc.git/hooks/ The repo location is: /git/prime/poc

Is there anyway I can determine the repo location in post-receive on the fly? (prefer not to chop up the post-receive pwd and "guess" at it)

Mouloud85
  • 3,826
  • 5
  • 22
  • 42
richard
  • 13
  • 2
  • 2
    That doesn't make sense to me. Isn't the git repo in `/git/hub/poc.git` ? – hobbs Oct 16 '14 at 21:04
  • I can't really understand your question either, but maybe `git rev-parse --show-toplevel` will help. – Andrew C Oct 16 '14 at 21:16
  • I am looking for the location of the committed files... am I mis-speaking when I call that the repo? sorry just got started with git last week – richard Oct 16 '14 at 21:16
  • @AndrewC That's exactly what i'm looking for! (git rev-parse --show-toplevel) THANKS! – richard Oct 16 '14 at 21:19
  • In that case you are a dup of http://stackoverflow.com/questions/957928/is-there-a-way-to-get-the-git-root-directory-in-one-command so I won't bother making my comment an answer. – Andrew C Oct 16 '14 at 21:35
  • Thanks for that -- after some further tinkering this command only works to show the toplevel of the path I'm in. It doesn't provide the same information from within the hooks dir most likely because the hooks path is not a git repo. – richard Oct 17 '14 at 13:42

0 Answers0