Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Issue while trying to commit - "repo.index.commit" #1183

Answered by Byron
ameyapranjale asked this question in Q&A
Discussion options

I can see a similar open issue but it relates to post-commit, hence adding this.

Traceback (most recent call last):
File "C:\Python37\lib\site-packages\git\index\fun.py", line 83, in run_commit_hook
creationflags=PROC_CREATIONFLAGS,)
File "C:\Python37\lib\subprocess.py", line 800, in init
restore_signals, start_new_session)
File "C:\Python37\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\XXXX\Desktop\auto_mate\deployment\gitautomate.py", line 42, in
repo1.index.commit("first commit")
File "C:\Python37\lib\site-packages\git\index\base.py", line 944, in commit
run_commit_hook('pre-commit', self)
File "C:\Python37\lib\site-packages\git\index\fun.py", line 85, in run_commit_hook
raise HookExecutionError(hp, ex) from ex
git.exc.HookExecutionError: Hook('C:\Users\XXXX\Desktop\auto_mate\deployment\clonedir.git\hooks\pre-commit') failed due to: OSError('[WinError 193] %1 is not a valid Win32 application')
cmdline: C:\Users\XXXX\Desktop\auto_mate\deployment\clonedir.git\hooks\pre-commit

You must be logged in to vote

As shown by File "C:\Python37\lib\subprocess.py", line 1207, in _execute_child subprocess is used to execute hooks. On windows, this probably doesn't include shellscripts.

Fixing this would be possible and a PR is certainly welcome.
Please feel free to keep commenting on the closed issue for follow-ups.

Replies: 2 comments

Comment options

---------------pre- commit file --------------

#!/bin/sh

HOOKS_DIR=$(dirname 0ドル)

acn_git_hooks_deploy_id XXXX

export CONFIG_DIRECTORY='C:/Users/XXXX/.acn-security-tools/config'
if uname | grep "MINGW"* > /dev/null;
then
py ${HOOKS_DIR}/detect_remote
py ${HOOKS_DIR}/detect_secret
else
python ${HOOKS_DIR}/detect_remote
python ${HOOKS_DIR}/detect_secret
fi

You must be logged in to vote
0 replies
Comment options

As shown by File "C:\Python37\lib\subprocess.py", line 1207, in _execute_child subprocess is used to execute hooks. On windows, this probably doesn't include shellscripts.

Fixing this would be possible and a PR is certainly welcome.
Please feel free to keep commenting on the closed issue for follow-ups.

You must be logged in to vote
0 replies
Answer selected by Byron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #1129 on February 26, 2021 11:18.

AltStyle によって変換されたページ (->オリジナル) /