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 newuser#example.com
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
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:
Rebooted into the live USB
Mounted a secondary drive.
fsck.ext4 -p [my root device]
fsck.ext4 -z [undo file on secondary drive] [my root device]
Stepped through all errors and allowed fsck to fix them
Rebooted into the system and opted to reinstall all packages (see script below)
Rebooted again ...
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 typing y and y and y!
And when I boot again it worked!!
Maybe this will help:
sudo chown username .gitconfig
Related
Hello this post has the same question as mine but the solution does not fix the problem.
I have tried sudo and this is the outcome:
(base) me$ sudo git clone https://github.com/soobinck/rotarod_ML.git
fatal: could not create work tree dir 'rotarod_ML': Permission denied
My problem, same as the post I mentioned above, is:
(base) brclab#FACMED006068:/run/user/1000/gvfs/smb-share:server=files.ubc.ca,share=team/bnrc/ninc/Raymond Lab/SooBin$ git clone https://github.com/soobinck/rotarod_ML.git
Cloning into 'rotarod_ML'...
error: chmod on /run/user/1000/gvfs/smb-share:server=files.ubc.ca,share=team/bnrc/ninc/Raymond Lab/SooBin/rotarod_ML/.git/config.lock failed: Operation not supported
fatal: could not set 'core.filemode' to 'false'
I would try this solution but since I don't know much about git and the remote computer (Linux), I wouldn't try messing around.
Can someone please give me guidance as to how to clone and pull the git repository? Thank you.
It looks like you're using an SMB share on Linux. When you use Git on a Unix system, it expects a file system where it can change the permission on the files with chmod(2). In your case, that doesn't work, and so when Git tries to information to the config file during the clone process, it fails.
My recommendation is that you clone onto a file system that isn't on an SMB mount. Git usually requires a POSIX-compliant file system, and on your system, that isn't one. Note that it's possible that if you use the cifs kernel driver to mount this file system and not gvfs, that it may work for you. gvfs's fuse mounts don't always expose all the proper functionality of the file system and don't necessarily work.
I am unable to delete ‘test/deployment/sandbox-v2/tmp/dns’ after deleting the github repository 'test'. I am unable to reclone it in my CentOS system. Even after recloning in other folder,running site.yml file of sandbox fails at logs. So i'm trying to completely remove test repository and reclone it for fresh run. I have tried all ways and commands to remove it, it gets removed as well but then gets recreated automatically with this file mentioned. Any clue how to completely remove it and clone a fresh repo.
It's hard to say but if this was bind-mounted into a container and that container was running its process as root (uid 0) then files it created would be owned by uid 0 even outside the container. Gotta get your sudo on.
Is dns a symlink to something within /etc that the user has no right to modify/delete?
If you go into the "test/deployment/sandbox-v2/tmp/" and do "ls -l" what does it say?
If the file is a symlink, unlink it with "unlink dns" and now you should be able to delete the file structure from the "test" directory.
Over the weekend I had to performed a fresh install on Ubuntu on my laptop.
I was restoring my files from my backup, but I used the wrong username.
I've tried to change the username and the $PATH but I'm still getting the same error
t0m#asuntu:~$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
=> Downloading nvm from git to '/home/ubut0m/.nvm'
=> mkdir: cannot create directory ‘/home/ubut0m’: Permission denied
ls: cannot access '/home/ubut0m/.nvm': No such file or directory
fatal: could not create leading directories of '/home/ubut0m/.nvm': Permission denied
Failed to clone nvm repo. Please report this!
t0m#asuntu:~$ vim .bashrc
t0m#asuntu:~$
I've tried removing and reinstalling everthing (NPM, Node, NVM), but don't know why I can't get the script to work. Any help is appreciated.
Check that you're $HOME environment variable matches that of the user you are currently running as, which you can check with whoami. Sometimes, some tools that elevate privileges (such as sudo) preserve the old user's home directory environment variable while running as the new user.
If that's not the problem, check that your home directory exists and has the correct permissions. Usually, if that's the problem, all sorts of other issues pop up (but I can understand a tendency to ignore such things on a newly restored machine).
If it's neither of those things, you can try making sure that you are in your home directory when running the wget | bash command although that really shouldn't be necessary (and if that turns out to be the issue, I would definitely file a bug with nvm about it).
Somehow, my system (Ubuntu WSL layer on Windows; so treat as exactly Ubuntu) went a bit crazy. For a directory (a git repo if it matters) /path/to/foo, running ls shows the git files ORIG_HEAD, index, and index.lock in there.
I tried to debug this by going cd .git, but an ls there showed me my same list of files as the parent!
I went as far as
/path/to/foo/.git/.git/.git
before stopping checking the recursion.
A possibly related issue that managed to show up is that the .htaccess file there is read as a file by Emacs on Windows, a file by vi on Linux, but a directory by emacs and a directory by bash.
That means that my computer really thinks
~/public_html/.git/.htaccess/.htaccess/.git/.htaccess/.git/.git
is identical to
~/public_html
So, needless to say, Apache also craps out and says that it's an invalid htaccess file .... though on an other machine (see: git repo) it runs just fine.
Help?
Tried nuking the directory via rm -rf and git clone-ing back, but the Apache problem persisted.
I removed the symlink to the directory via unlink:
~$ unlink public_html
then re-mounted it, making sure that there wasn't a trailing space
~$ ln -s /mnt/c/Users/USER/pathto/repo /home/USER/public_html
I have downloaded R tree from http://libspatialindex.github.com/
Since on running ./autogen.sh I was getting file/folder not found, therefore I downloaded the file autogen.sh from the github repository given below:
https://raw.github.com/libspatialindex/libspatialindex/9a5a2f4d83c3ec7be4dbf2c8a86341703d837185/autogen.sh
Now when I run ./autogen.sh I am getting "Permission denied"
And if I run sh ./autogen.sh I am getting:
glibtoolize or libtoolize not found. Giving up!
Please suggest what should I do now
EDIT:Also I want to use libspatialindex inside my C++ project. I am using netbeans. I mean I want to use the functions inside libspatialindex inside my netbeans project. How should I use the same. Right now I have run the config and make command in a separate directory. I am not getting as to how to use them inside my project.
Install libtool from your package manager.
To fix the 'Permission Denied' error you need to edit the permissions of your autogen.sh file. Run this command:
chmod +x autogen.sh
I got this error after restoring a library from a Backup to a NTFS directory.
I discovered that another reason this can occur is if the mounted partition has noexec flag on it.
Run mount to see if noexec has been set on the partition.
Update /etc/fstab or add -o exec to the mount command.
Hope, it helps others in the same situation as me.