When i commit changes via Github Desktop, pre-commit cannot handle the changes and commit them but overwrites all other stages changes (the once i didn't intent to commit now) by its improvements.
This appears since during a commit in Github Desktop to my local branch, Avast free antivirus interrupted the process to check some file for virus. Since i didn't want Avast to interrupt it i canceled the scan, probably making things worse.
Now i get the following message when i'm trying to commit:error message
I tried already to use
- git reset, git update-indes,
- delete the repo and set it up new
- use pre-commit uninstall and install
- use pre-commit run --all-files
On another machine, the same repo runs smoothly. Does anyone has an idea what and how i have to reset to solve this issue?
Here is the pre-commit log:
version information
pre-commit version: 3.7.1
git --version: git version 2.45.1.windows.1
sys.version:
3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
sys.executable: C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Scripts\python.exe
os.name: nt
sys.platform: win32
error information
An unexpected error has occurred: CalledProcessError: command: ('C:\\Users\\UsrName\\AppData\\Local\\GitHubDesktop\\app-3.4.2\\resources\\app\\git\\mingw64\\bin\\git.EXE', '-c', 'core.autocrlf=false', 'apply', '--whitespace=nowarn', 'C:\\Users\\UsrName\\.cache\\pre-commit\\patch1719821150-18184')
return code: 128
stdout: (none)
stderr:
error: missing config value GIT_CONFIG_VALUE_0
fatal: unable to parse command-line config
Traceback (most recent call last):
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\staged_files_only.py", line 29, in _git_apply
cmd_output_b('git', *args)
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\util.py", line 111, in cmd_output_b
raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('C:\\Users\\UsrName\\AppData\\Local\\GitHubDesktop\\app-3.4.2\\resources\\app\\git\\mingw64\\bin\\git.EXE', 'apply', '--whitespace=nowarn', 'C:\\Users\\UsrName\\.cache\\pre-commit\\patch1719821150-18184')
return code: 128
stdout: (none)
stderr:
error: missing config value GIT_CONFIG_VALUE_0
fatal: unable to parse command-line config
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\staged_files_only.py", line 86, in _unstaged_changes_cleared
_git_apply(patch_filename)
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\staged_files_only.py", line 32, in _git_apply
cmd_output_b('git', '-c', 'core.autocrlf=false', *args)
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\util.py", line 111, in cmd_output_b
raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('C:\\Users\\UsrName\\AppData\\Local\\GitHubDesktop\\app-3.4.2\\resources\\app\\git\\mingw64\\bin\\git.EXE', '-c', 'core.autocrlf=false', 'apply', '--whitespace=nowarn', 'C:\\Users\\UsrName\\.cache\\pre-commit\\patch1719821150-18184')
return code: 128
stdout: (none)
stderr:
error: missing config value GIT_CONFIG_VALUE_0
fatal: unable to parse command-line config
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\staged_files_only.py", line 29, in _git_apply
cmd_output_b('git', *args)
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\util.py", line 111, in cmd_output_b
raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('C:\\Users\\UsrName\\AppData\\Local\\GitHubDesktop\\app-3.4.2\\resources\\app\\git\\mingw64\\bin\\git.EXE', 'apply', '--whitespace=nowarn', 'C:\\Users\\UsrName\\.cache\\pre-commit\\patch1719821150-18184')
return code: 128
stdout: (none)
stderr:
error: missing config value GIT_CONFIG_VALUE_0
fatal: unable to parse command-line config
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\error_handler.py", line 73, in error_handler
yield
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\main.py", line 389, in main
return hook_impl(
^^^^^^^^^^
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\commands\hook_impl.py", line 271, in hook_impl
return retv | run(config, store, ns)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\commands\run.py", line 418, in run
with contextlib.ExitStack() as exit_stack:
File "C:\Users\UsrName\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 586, in __exit__
raise exc_details[1]
File "C:\Users\UsrName\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 571, in __exit__
if cb(*exc_details):
^^^^^^^^^^^^^^^^
File "C:\Users\UsrName\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 144, in __exit__
next(self.gen)
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\staged_files_only.py", line 112, in staged_files_only
with _intent_to_add_cleared(), _unstaged_changes_cleared(patch_dir):
File "C:\Users\UsrName\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 144, in __exit__
next(self.gen)
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\staged_files_only.py", line 96, in _unstaged_changes_cleared
_git_apply(patch_filename)
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\staged_files_only.py", line 32, in _git_apply
cmd_output_b('git', '-c', 'core.autocrlf=false', *args)
File "C:\Users\UsrName\Dokumente\GitHub\RepoName\.env\Lib\site-packages\pre_commit\util.py", line 111, in cmd_output_b
raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('C:\\Users\\UsrName\\AppData\\Local\\GitHubDesktop\\app-3.4.2\\resources\\app\\git\\mingw64\\bin\\git.EXE', '-c', 'core.autocrlf=false', 'apply', '--whitespace=nowarn', 'C:\\Users\\UsrName\\.cache\\pre-commit\\patch1719821150-18184')
return code: 128
stdout: (none)
stderr:
error: missing config value GIT_CONFIG_VALUE_0
fatal: unable to parse command-line config
GIT_CONFIG_*
env vars. Do you have ``GIT_CONFIG_COUNT` env var? – Tearjerkercheck-added-large-files
.trim-trailing-whitespace
passed before failing on large files. – Thioniccheck-added-large-files
and now it errors oncheck-merge-conflicts
after passingpython-ast
andjson
. EDIT: xref: github.com/pre-commit/pre-commit/issues/3245 – Thionic