Reputation: 31
I was using my git fine but suddenly when I tried to use git status
it showed me
fatal: unable to access '/home/username/.gitconfig': Bad message
I first thought it is because of my git config file is in the venv, but it was OK and, as the error shows, it is because of the .gitconfig
file in my user directory!
First of all as what I found on the internet I used git config --global user.name "NewUser"
and git config --global user.email [email protected]
but it ends in the same error as before.
After I closed and opened my VScode again a Git extension gave me the warning that it cant detect any git exe file on the system and I need to install the Git again!
And when I checked for git --version
it gave me the same error again!
Literally I cant use any git
command!
Then I tried to write the configuration by myself and when I opened it in terminal with nano it was nothing in it! and when I wanted to save the changes it gave another error as
[ Error writing .gitconfig: Bad message ]
Then I looked at the permissions of the file and it was just question mark instead of normal permissions
Then I tried to change the permission by chmod
but it gave the access denied error again!
chmod: cannot access '.gitconfig': Bad messag
Then I tried to remove it but it cant be removed too!
rm: cannot remove '.gitconfig': Bad message
I installed and removed git for several time! it did not work either.
I am using manjaro 20.2
Any idea would be appreciated!
UPDATED
This is the errors in for dmesg
Bunch of these errors here and there
Upvotes: 1
Views: 464
Reputation: 1323223
As mentioned here, the question marks in the ls output just indicate that it could not stat() the directory entry.
It could be a disk error or possibly filesystem corruption: for an ArchLinux distro, see sudo journalctl --since=today
or, form last boot, sudo journalctl -b -1
to reveal further details.
Check the partition you are in (df -h .
) and see if this is a filesystem mounting issue.
If you see a bunch of messages like:
EXT4-fs error (device nvme0n1p2): ext4_lookup:1574: inode #4833958: comm ls: iget: checksum invalid
You should look at your partition from an external session (meaning a live session from an USB disk), as in here:
fsck.ext4 -p [my root device]
fsck.ext4 -z [undo file on secondary drive] [my root device]
The OP amir-mohammadian confirms in the comments:
Because I am in my first steps in Linux, I always have a live boot of my distro.
So it was quick, and when I used it "
fsck
" first it said I cant use any-p
or-z
because of some errors and I have to do it manually, so I was just typingy
andy
andy
!
And when I boot again it worked!!
Upvotes: 3