How do I properly set up hooks on a remote that is specified via the file:// protocol?

Say I’ve got an upstream repo (origin) that was added with

git remote add origin file:////

The repo.git is acually a windows shared folder where I and my dev colleagues have r/w access assigned.

  • git- strange characters in output (msys-git)
  • Promote all builds to master on Jenkins
  • How can I use Visual Studio to work with a Node.js project from an Openshift Git repository?
  • What is the Mercurial equivalent to `git log --graph --decorate --oneline --all`?
  • Vim Bundle vundle wont install
  • git push --force by default
  • Now, I want to set up a post-receive hook on that notifies Trac about freshly pushed revisions for automatic ticket updating. Basically, this is done by calling an executable on that does some work in the database there.

    However, I notified that the hook for some reason doesn’t work.
    So I’ve set up the hook to print everything she’s doing to D:/temp/post-receive.log and issued a git push in order to trigger the hook.

    When I looked into D:/temp on, there was no logfile created.
    Then, another question of me came into mind:
    When actually the binaries of my machine are used for executing the hook, maybe also the paths of my machine are used. I looked into D:/temp and voilá, here we have the post-receive.log.

    I traced the pwd to the logfile and it is not D:/repos/repo.git (what I expected) but actually is // Obviously the whole hook is executed in the context of the pusher’s machine and not in the context of the repo machine (

    This is no problem for me since I have admin access to the remote machine and could use administrative shares in order to get my hook going (i.e. \\\D$\repos\repo.git etc). But this is an issue for my colleagues since they are plain users and no roots.

    How do I set up my post-receive hook properly so that it works as expected?

    How do I force my hook to be entirely run on the remote machine without using anything from my machine?

    Do I really have to implement a real server hosting my repo? Or are there other ways that don’t need a server?

  • Merging XML file changes in git
  • Git: how to avoid repetitive committing with sub-sub-sub… Git -repos?
  • Visual Studio 2013 with TFS online using Git: Saving files checks-in automatically
  • git java wrapper - git pull never ends
  • Bad git config file .git/config
  • Git post-checkout - how to reject push if Composer installation fails
  • One Solution collect form web for “How do I properly set up hooks on a remote that is specified via the file:// protocol?”

    a post-receive hook is run after receiving data on the machine that is hosting the repository.

    now the machine that is “hosting the repository” is not the file-server where the actual packed-refs and other git database files are stored. (this file-server could be anything from a redundant cloud-based storage appliance to any old NAS-enabled “network disk”).

    Instead it is the machine that runs the “git frontend” (that is, the git commands that actually interact with the database).

    Now you are using a “network share” to host your (remote) git repository. For your computer (the client), this is just another disk device (like your floppy) and the git on your client will happily store database-files there, and run any hooks. But this is your computer, since it is being told to run the remote locally – simply because the file:// protocol does mean “local”.

    Btw, the fact that your remote is named is meaningless: this name is only there for you to keep track of multiple remotes, but it could be called instead.

    So there is no way to run any script on the file-server that happens to store some files names pack-refs and similar.

    If you want to have a git server to run hooks for you, you must have a git server first. Even worse: if you want a git server on machineX to run scripts on machineX, you must install a git server on machineX first.

    The good news: there is no need to “implement a real server”. Just install a pre-existing one. You will find docuementation about that in the Git Book, but for starters it’s basically enough to have git (for interaction with the database) and sshd (for secure communication via the network; and for calling git when appropriate) installed.

    Finally: i’m actually quite glad that you need to have software (e.g. a server) running on the remote end to execute code there. Just imagine what it would mean if copying some html files to your USB disk would suddenly spawn a web server out of thin air. Not to think of w32-virusses breeding happily on my linux NAS…

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