git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.31k stars 2.52k forks source link

The newest Git prompt error when I push to remote while the older version of Git didn't have this error #5007

Open duxingzhe opened 3 months ago

duxingzhe commented 3 months ago

Setup

$ git --version --build-options

git version 2.45.1.windows.1
cpu: x86_64
built from commit: 965b16798dab6962ada5b0d8cf0dca68f385c448
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
$ cmd.exe /c ver

Microsoft Windows [版本 10.0.22631.3737]
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
> type "$env:USERPROFILE\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Well, I use [tar.bz2](https://registry.npmmirror.com/-/binary/git-for-windows/v2.45.2.windows.1/Git-2.45.2-64-bit.tar.bz2) file. So there is no this info.

No

Details

powershell in IDEA

git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master

Enumerating objects: 5, done.

cannot spawn git: Exec format error

All Url

rimrul commented 3 months ago

cannot spawn git: Exec format error

is that the whole output? Or is it something like

error: cannot spawn git: Exec format error or fatal: cannot spawn git: Exec format error?

duxingzhe commented 3 months ago

Yeah, that is all the quote.

error: cannot spawn git: Exec format error

dscho commented 3 months ago

Maybe set the environment variable GIT_TRACE=1 and try again? This will hopefully shed some light into what is going on.

duxingzhe commented 3 months ago

After I set GIT_TRACE=1 in the terminal in Android Studio,and run the same command given by AS. It's work fine. Therefore, I need to further review.

duxingzhe commented 3 months ago

I think this still a problem needed to be reviewed in the source code to ensure the behavior of git in newest version is not changed and work properly.

duxingzhe commented 3 months ago

Maybe set the environment variable GIT_TRACE=1 and try again? This will hopefully shed some light into what is going on.

Now, I confirmed this problem. If I don't set GIT_TRACE=1 in the terminal, git can't work properly, and can't push to remote. Please fix it. Thanks.

dscho commented 3 months ago

If I don't set GIT_TRACE=1 in the terminal, git can't work properly, and can't push to remote.

That makes little sense, as GIT_TRACE is not expected to change how Git looks up and spawns programs.

Can you please re-run the command after downloading, extracting and starting Sysinternals' Process Monitor, and then analyze the logs to find out which process spawning failed and what path the intended executable has?

duxingzhe commented 3 months ago

If I don't set GIT_TRACE=1 in the terminal, git can't work properly, and can't push to remote.

That makes little sense, as GIT_TRACE is not expected to change how Git looks up and spawns programs.

Can you please re-run the command after downloading, extracting and starting Sysinternals' Process Monitor, and then analyze the logs to find out which process spawning failed and what path the intended executable has?

OK.

duxingzhe commented 3 months ago

If I don't set GIT_TRACE=1 in the terminal, git can't work properly, and can't push to remote.

That makes little sense, as GIT_TRACE is not expected to change how Git looks up and spawns programs.

Can you please re-run the command after downloading, extracting and starting Sysinternals' Process Monitor, and then analyze the logs to find out which process spawning failed and what path the intended executable has?

Logfile.zip

The file has been uploaded. It just include git. Please find out why.

dscho commented 3 months ago

Please find out why.

I asked you to analyze it yourself, first.

duxingzhe commented 3 months ago

Sorry. I think you overestimate my ability. I can't analyze it.

duxingzhe commented 3 months ago

The reproducing steps as follows:

  1. Use newest git (2.45.1.windows.1 unzip version) to create a commit.
  2. Push to remote. It failed.
  3. Use older git to push. It failed.
  4. Undo commit, Use older git to commit and push. It succeed.
  5. Set GIT_TRACE=1 and use newest git (2.45.1.windows.1 unzip version) to create a commit and push, It succeed.

I think there may be some changes in new version that makes git fail to push.