Jason
Jason

Reputation: 2492

Retrieve git repository name during git push at server level

I am new to git, so my understanding is fairly naive. In Perforce I can do p4 describe, and it can give me all the info I need for a changelist.

Here when I do git push origin master, I want to know which repository the commits are being pushed to during a pre-receive hook at the git server level.

I have seen option like basename git rev-parse --show-toplevel, but this happens to be at the client level. I want to do something similar at the server level.

Is this possible?

Upvotes: 1

Views: 168

Answers (1)

Makoto
Makoto

Reputation: 106389

git remote -v will tell you what remote repository(ies) your pull and push are coming from.

Example output:

git remote -v
origin  [email protected]:null/Python.git (fetch)
origin  [email protected]:null/Python.git (push)

The name of the repository is null/Python.

Also, unless I'm misunderstanding you, you are shown what repository the files are being pushed to during a push:

To [email protected]:null/Python.git
 * [new branch]      ruby-version -> ruby-version

Again, null/Python is the name of the remote repository.

Upvotes: 2

Related Questions