Reputation: 311
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.
Upvotes: 7
Views: 18402
Reputation: 1329542
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 parsedSigned-off-by: Glen Choo
When a tree oid is invalid,
parse_tree_indirect()
can returnNULL
.
Check forNULL
instead of proceeding as though it were a valid pointer and segfaulting.
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 109
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.
Upvotes: 5
Reputation: 316
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.
Upvotes: 13
Reputation: 311
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.
Upvotes: 3
Reputation: 319
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.
Upvotes: 1