how can git post-receive hook get name of repo it is running on?

前端 未结 4 1666
我在风中等你
我在风中等你 2020-12-28 14:40

I have a git post receive hook that will trigger a build on my build system. I need to create a string of the form \"$repo-name + $branch\" in the hook script.

I can

4条回答
  •  萌比男神i
    2020-12-28 14:56

    You could do git rev-parse --show-toplevel, which will give you the path of the top-level directory, and pull the name out of that (reponame.git is conventional for remotely-accessible repos).

    $PWD might also have the same information, but I'm unsure.

提交回复
热议问题