Segmentation fault for git commit command (Windows)
Asked Answered
F

6

7

I have started to work with project, which I cloned from bitbucket. I use as Git Bash, as SourceTree. I changed one file and try to commit my change. I can execute the command "add", but when I try to execute the command "commit" (git commit -m "for testing"), I get the following error: Segmentation fault.

I got an error in SourceTree too. But if I create my new folder & file, the commit happens successfully

How I can fix the problem situation? Thanks in advance.

Flori answered 15/6, 2017 at 13:57 Comment(2)
Which version of git do you use? What is the exact output of the console. The first thing I see is surely to get the last version of git...Feminine
I used version 2.13.1Flori
F
3

I have resolved the problem. The last git version (2.13.1) has the bug - it has been released 05.06.2017. I installed previous version (2.12.2) and now all is OK.

Flori answered 19/6, 2017 at 13:11 Comment(0)
B
13

Running git 2.15.1.windows.2 on Windows 10 x64 v1709

For me the problem was caused by a faulty index. To resolve I ran the following from the project directory:

rm .git/index

git reset

As you can see from the image in this link, I didn't loose any changes by performing a reset.

Bait answered 5/12, 2017 at 10:37 Comment(0)
P
5

If you already have Git installed, you can get the latest development version via Git itself:

git clone https://github.com/git/git

but this didn't work for me.I uninstalled the git and then again downloaded then my problem got resolved.

Patronymic answered 30/1, 2018 at 6:51 Comment(0)
F
3

I have resolved the problem. The last git version (2.13.1) has the bug - it has been released 05.06.2017. I installed previous version (2.12.2) and now all is OK.

Flori answered 19/6, 2017 at 13:11 Comment(0)
S
1

I had the same issue on some project, I could no checkout a new or an existing branch. I installed the latest version of git from the website and now my version is

> git --version
  git version 2.13.1.windows.2

The issue seems fixed with this build. For now.

Subaltern answered 19/6, 2017 at 8:27 Comment(0)
D
0

use git reset SHA --hard

Where SHA points to a valid SHA before the error

Changes done after this point is lost. But repo is saved.

Diatonic answered 10/4, 2020 at 3:27 Comment(0)
H
0

For me the problem was caused by a faulty index.

With Git 2.36 (Q2 2022), you will see more details instead of a segfault.
Git now check the return value from parse_tree_indirect() to turn segfaults into calls to die().
For clone/checkout, but can also be applied to commit.

See commit 8d2eaf6 (01 Mar 2022) by Glen Choo (chooglen).
(Merged by Junio C Hamano -- gitster -- in commit bde1e3e, 13 Mar 2022)

checkout, clone: die if tree cannot be parsed

Signed-off-by: Glen Choo

When a tree oid is invalid, parse_tree_indirect() can return NULL.
Check for NULL instead of proceeding as though it were a valid pointer and segfaulting.

Havildar answered 18/3, 2022 at 6:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.