Pergunta

The setup:

  • have a remote git repository on a LAN server (linux)
  • this repository can be accessed through samba, and through ssh. Both of these access methods are used for various developers, and all developers working on windows.
  • the post-receive script (at the end) calls a command line smtp mailer, which will send out an email (through the internal smtp server)
  • I have 2 command line smpt mailers available, one for windows (bmail.exe), the other one for linux (smtpstoat). Both with

The problem:

  • If the post-receive script calling the linux executable (smtpstoat), git push execution is proper (emails are sent) for developers that are accessing the remote repository through ssh. But when the other part of the developers, who are accessing through samba, executing a git push command, git complains: remote: ./hooks/smtpstoat: ./hooks/smtpstoat: cannot execute binary file
  • And if I modify the post-receive script to call the windows executable (bmail.exe), the developers with samba access have no issues with git push. But the ssh users got: remote: hooks/post-receive: line 708: ./hooks/bmail.exe: cannot execute binary file

How can I make this email sending working no matter how do you access the remote repository?

Foi útil?

Solução

Well, the hook is executed by the git process writing to the repository. When you push over SSH this process is running in the SSH session. So, when a developed pushes over SSH what happens is he actually loggs in, updates the repo and executes the hook.

When someone pushes over SMB, it's his git proccess who updates the repo. The process is running on his machine, and sure enough it can't execute that binary.

Anyway, push over SMB is not a really awesome idea. I guess the best solution in your case is to make Windows developers push over SSH. It shouldn't be a problem for them.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top