# Git post-receive hook using python (on Windows)

**URL:** <https://community.cloudogu.com/t/git-post-receive-hook-using-python-on-windows/1324>\
**Category:** SCM-Manager (General)\
**Created:** [May 21, 2024, 2:21pm UTC](https://community.cloudogu.com/t/git-post-receive-hook-using-python-on-windows/1324 "2024-05-21T14:21:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paolongit](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/paolongit/32/1578_2.png) [@paolongit](https://community.cloudogu.com/u/paolongit)\
**Post date:** [May 21, 2024, 2:21pm UTC](https://community.cloudogu.com/t/git-post-receive-hook-using-python-on-windows/1324/1 "2024-05-21T14:21:44Z")

</div>

Hi,  
I created a **post-receive** hook using python.

I put the hook into the hooks folder of a remote repository on the same machine where I run SCM Manager application. Operating System: Windows 2016 Server.  
The hook works fine.

When I put the same hook into a SCM hooks repository:  
_repository_  
_+ data_  
_++ hooks_  
It doesn’t work; I receive the following error:

_remote: error: [SCM] failure during file hook execution_

from log:

2024-05-21 16:58:51.418 [qtp1288354730-103] [FdUDQAhyNi] ERROR sonia.scm.web.GitFileHook - failure during file hook execution  
java.io.IOException: Cannot run program “D:\SCM-Manager\repositories\72UD2QABi3E\data\hooks\post-receive” (in directory “D:\SCM-Manager\repositories\72UD2QABi3E\data”): CreateProcess error=193, %1 is not a valid Win32 application

but, if I create a .bat file: **post-receive.bat** :

_ **@echo off** _  
_ **echo Hello, World!** _  
_ **pause** _

It works.

Can you please help me?

Thanks,  
Paolo

---

<div class="post-metadata">

**Author:** ![paolongit](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/paolongit/32/1578_2.png) [@paolongit](https://community.cloudogu.com/u/paolongit)\
**Post date:** [May 22, 2024, 2:41pm UTC](https://community.cloudogu.com/t/git-post-receive-hook-using-python-on-windows/1324/2 "2024-05-22T14:41:17Z")

</div>

Hi,  
I solved it by my own with a workaround. I created a batch calling the python file.

post-receive.bat:  
_@echo off_  
_python \<path\>\hooks\post-receive.py %_\*

post-receive.py  
…python code…

Paolo

---

<div class="post-metadata">

**Author:** ![christoph.loose](https://dub1.discourse-cdn.com/flex013/user_avatar/community.cloudogu.com/christoph.loose/32/1400_2.png) [@christoph.loose](https://community.cloudogu.com/u/christoph.loose)\
**Post date:** [May 23, 2024, 7:13am UTC](https://community.cloudogu.com/t/git-post-receive-hook-using-python-on-windows/1324/3 "2024-05-23T07:13:55Z")

</div>

Hey @paolongit

thank you for sharing your solution with the community ❤
