I would like to run a script on server side every time a user runs a git pull. However no hooks can achieve that, so I'm trying to find "hacks" to do so. Actually, I would also be happy to run the script "more often", for example every time a user connects through ssh.

I also want to do that as a non-root user (so I can't create new users), and I don't want to lose my hability to connect through regular ssh.

I tried to modify the bashrc file, but unfortunately the git protocol that uses ssh does not call this file. Any other idea?

1 Answers

1
VonC On Best Solutions

I tried to modify the bashrc file, but unfortunately the git protocol that uses ssh does not call this file. Any other idea?

Replace (or ask an admin to replace) on the server side the /usr/bin/git-upload-pack executable by a script which would:

  • call the actual git upload-pack command
  • notifies you when it is called, since this is triggered by a fetch/pull