1

I have a gitlab server. Gitlab has its own hooks symlinked to every git repo. I wish to be able to tell the difference in between repos when that script is called. I seen this but I don't think it provides any useful information in this case.

Perhaps it may be possible to detect which repo the hook belongs to by figuring out where the script was executed from? (The original script is in ruby) Or possibly to check /home/git/git-data/repositories/<all git users>/<all repos> for the right ref? Either way I do not know how to do that.

Community
  • 1
  • 1
Kaiden Prince
  • 462
  • 3
  • 18

1 Answers1

0

In your hook, you can try:

git rev-parse --git-dir

That should give the full path of the bare repo in which the hook (here a post-receive one) is executed.
That is what I used in "Is there a way to get the git root directory in one command?".

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283